Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 21:10:05 +01:00
Update for latest SpoutAPI
Dieser Commit ist enthalten in:
Ursprung
15977e85a5
Commit
3c00535d2e
@ -18,15 +18,15 @@
|
||||
|
||||
package com.sk89q.worldedit.spout;
|
||||
|
||||
import org.spout.api.generator.biome.BiomeType;
|
||||
import org.spout.api.generator.biome.Biome;
|
||||
|
||||
/**
|
||||
* @author zml2008
|
||||
*/
|
||||
public class SpoutBiomeType implements com.sk89q.worldedit.BiomeType {
|
||||
private final BiomeType type;
|
||||
private final Biome type;
|
||||
|
||||
public SpoutBiomeType(BiomeType type) {
|
||||
public SpoutBiomeType(Biome type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class SpoutBiomeType implements com.sk89q.worldedit.BiomeType {
|
||||
return type.getName().toLowerCase().replace(" ", "");
|
||||
}
|
||||
|
||||
public BiomeType getSpoutBiome() {
|
||||
public Biome getSpoutBiome() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import com.sk89q.worldedit.BiomeTypes;
|
||||
import com.sk89q.worldedit.UnknownBiomeTypeException;
|
||||
import org.spout.api.generator.biome.BiomeGenerator;
|
||||
import org.spout.api.generator.biome.BiomeType;
|
||||
import org.spout.api.generator.biome.Biome;
|
||||
|
||||
public class SpoutBiomeTypes implements BiomeTypes {
|
||||
private final Map<String, SpoutBiomeType> types = new HashMap<String, SpoutBiomeType>();
|
||||
@ -46,7 +46,7 @@ public class SpoutBiomeTypes implements BiomeTypes {
|
||||
}
|
||||
|
||||
public void registerBiomeTypes(BiomeGenerator generator) {
|
||||
for (BiomeType type : generator.getBiomes()) {
|
||||
for (Biome type : generator.getBiomes()) {
|
||||
final SpoutBiomeType weType = new SpoutBiomeType(type);
|
||||
if (!types.containsKey(weType.getName())) {
|
||||
types.put(weType.getName(), weType);
|
||||
|
@ -207,8 +207,8 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
public void flushChanges() {
|
||||
if (items != null) {
|
||||
Inventory inv = player.getEntity().getInventory();
|
||||
for (int i = 0; i < items.length && i < player.getEntity().getInventorySize(); ++i) {
|
||||
inv.setItem(items[i], i);
|
||||
for (int i = 0; i < items.length && i < inv.getSize(); ++i) {
|
||||
inv.setItem(i, items[i]);
|
||||
}
|
||||
items = null;
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ public class SpoutServerInterface extends ServerInterface {
|
||||
public void onCommandRegistration(List<Command> commands, CommandsManager<LocalPlayer> manager) {
|
||||
for (Command command : commands) {
|
||||
org.spout.api.command.Command spoutCommand = game.getRootCommand().addSubCommand(plugin, command.aliases()[0])
|
||||
.addAlias(command.aliases()).setRawExecutor(executor).
|
||||
setUsage(command.usage()).setHelp(command.desc());
|
||||
.addAlias(command.aliases()).setRawExecutor(executor)
|
||||
.setHelp("/" + command.aliases()[0] + " " + command.usage() + " - " + command.desc());
|
||||
Method cmdMethod = manager.getMethods().get(null).get(command.aliases()[0]);
|
||||
if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
|
||||
spoutCommand.setPermissions(false, cmdMethod.getAnnotation(CommandPermissions.class).value());
|
||||
|
@ -94,7 +94,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
public boolean setBlockType(Vector pt, int type) {
|
||||
Material mat = MaterialRegistry.get((short) type);
|
||||
if (mat != null && mat instanceof BlockMaterial) {
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)0, true, WorldEditPlugin.getInstance());
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)0, WorldEditPlugin.getInstance());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
public boolean setTypeIdAndData(Vector pt, int type, int data) {
|
||||
Material mat = MaterialRegistry.get((short) type);
|
||||
if (mat != null && mat instanceof BlockMaterial) {
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)data, true, WorldEditPlugin.getInstance());
|
||||
return world.setBlockMaterial(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (BlockMaterial) mat, (short)data, WorldEditPlugin.getInstance());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -159,7 +159,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public void setBlockData(Vector pt, int data) {
|
||||
world.setBlockData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) data, true, WorldEditPlugin.getInstance());
|
||||
world.setBlockData(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ(), (short) data, WorldEditPlugin.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ public class SpoutWorld extends LocalWorld {
|
||||
}
|
||||
|
||||
public void setBiome(Vector2D pt, BiomeType biome) {
|
||||
if (biome instanceof SpoutBiomeType &&
|
||||
if (biome instanceof SpoutBiomeType &&
|
||||
world.getGenerator() instanceof BiomeGenerator) {
|
||||
BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
|
||||
gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome());
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren