From fd1b15c5da05fe628af4df1cf047c3407dcc6ef5 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Sat, 30 Jun 2012 16:54:31 -0700 Subject: [PATCH] Updated for SpoutAPI changes --- .../sk89q/worldedit/spout/SpoutPlayer.java | 2 +- .../worldedit/spout/WorldEditPlugin.java | 20 +++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java index af3d363d9..01c64ff22 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java @@ -51,7 +51,7 @@ public class SpoutPlayer extends LocalPlayer { @Override public int getItemInHand() { VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); - ItemStack itemStack = vanillaPlayer.getInventory().getCurrentItem(); + ItemStack itemStack = vanillaPlayer.getInventory().getQuickbar().getCurrentItem(); return itemStack != null ? itemStack.getMaterial().getId() : 0; } diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java b/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java index 64d8a1894..2afa683ce 100644 --- a/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java +++ b/src/main/java/com/sk89q/worldedit/spout/WorldEditPlugin.java @@ -37,7 +37,6 @@ import org.spout.api.geo.World; import org.spout.api.player.Player; import org.spout.api.plugin.CommonPlugin; import org.spout.api.scheduler.TaskPriority; -import org.spout.api.util.Named; import java.io.*; import java.util.jar.JarFile; @@ -48,7 +47,7 @@ import java.util.zip.ZipEntry; * * @author sk89q */ -public class WorldEditPlugin extends CommonPlugin implements Named { +public class WorldEditPlugin extends CommonPlugin { /** * The server interface that all server-related API goes through. */ @@ -94,21 +93,21 @@ public class WorldEditPlugin extends CommonPlugin implements Named { loadConfiguration(); // Setup interfaces - server = new SpoutServerInterface(this, getGame()); + server = new SpoutServerInterface(this, getEngine()); controller = new WorldEdit(server, config); // Now we can register events! registerEvents(); - getGame().getScheduler().scheduleAsyncRepeatingTask(this, - new SessionTimer(controller, getGame()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST); + getEngine().getScheduler().scheduleAsyncRepeatingTask(this, + new SessionTimer(controller, getEngine()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST); } /** * Called on plugin disable. */ public void onDisable() { - for (Player player : getGame().getOnlinePlayers()) { + for (Player player : getEngine().getOnlinePlayers()) { LocalPlayer lPlayer = wrapPlayer(player); if (controller.getSession(lPlayer).hasCUISupport()) { lPlayer.dispatchCUIHandshake(); @@ -116,7 +115,7 @@ public class WorldEditPlugin extends CommonPlugin implements Named { } controller.clearSessions(); config.unload(); - getGame().getScheduler().cancelTasks(this); + getEngine().getScheduler().cancelTasks(this); } /** @@ -131,7 +130,7 @@ public class WorldEditPlugin extends CommonPlugin implements Named { * Register the events used by WorldEdit. */ protected void registerEvents() { - getGame().getEventManager().registerEvents(new WorldEditListener(this), this); + getEngine().getEventManager().registerEvents(new WorldEditListener(this), this); } /** @@ -346,11 +345,6 @@ public class WorldEditPlugin extends CommonPlugin implements Named { session.dispatchCUISelection(wrapPlayer(player)); } - @Override - public String getName() { - return getDescription().getName(); - } - static WorldEditPlugin getInstance() { return instance; }