From 3c00535d2e8dc5f107710f85aedf6ba622d049aa Mon Sep 17 00:00:00 2001 From: zml2008 Date: Thu, 10 May 2012 18:27:50 -0700 Subject: [PATCH] Update for latest SpoutAPI --- .../java/com/sk89q/worldedit/spout/SpoutBiomeType.java | 8 ++++---- .../java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java | 4 ++-- .../com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java | 4 ++-- .../com/sk89q/worldedit/spout/SpoutServerInterface.java | 4 ++-- src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java b/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java index f6ca49858..efa48e108 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeType.java @@ -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; } diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java b/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java index 01383a8a2..ec9f01a06 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutBiomeTypes.java @@ -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 types = new HashMap(); @@ -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); diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java index 63d8863cd..6f2b20af2 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java @@ -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; } diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java b/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java index 2ce5c6060..d5233ab2d 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutServerInterface.java @@ -93,8 +93,8 @@ public class SpoutServerInterface extends ServerInterface { public void onCommandRegistration(List commands, CommandsManager 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()); diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java index 8cf59b032..695daa217 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java @@ -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());