Updated for SpoutAPI changes

This commit is contained in:
zml2008 2012-06-30 16:54:31 -07:00
parent 7bc66b8247
commit fd1b15c5da
2 changed files with 8 additions and 14 deletions

View File

@ -51,7 +51,7 @@ public class SpoutPlayer extends LocalPlayer {
@Override @Override
public int getItemInHand() { public int getItemInHand() {
VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController();
ItemStack itemStack = vanillaPlayer.getInventory().getCurrentItem(); ItemStack itemStack = vanillaPlayer.getInventory().getQuickbar().getCurrentItem();
return itemStack != null ? itemStack.getMaterial().getId() : 0; return itemStack != null ? itemStack.getMaterial().getId() : 0;
} }

View File

@ -37,7 +37,6 @@ import org.spout.api.geo.World;
import org.spout.api.player.Player; import org.spout.api.player.Player;
import org.spout.api.plugin.CommonPlugin; import org.spout.api.plugin.CommonPlugin;
import org.spout.api.scheduler.TaskPriority; import org.spout.api.scheduler.TaskPriority;
import org.spout.api.util.Named;
import java.io.*; import java.io.*;
import java.util.jar.JarFile; import java.util.jar.JarFile;
@ -48,7 +47,7 @@ import java.util.zip.ZipEntry;
* *
* @author sk89q * @author sk89q
*/ */
public class WorldEditPlugin extends CommonPlugin implements Named { public class WorldEditPlugin extends CommonPlugin {
/** /**
* The server interface that all server-related API goes through. * The server interface that all server-related API goes through.
*/ */
@ -94,21 +93,21 @@ public class WorldEditPlugin extends CommonPlugin implements Named {
loadConfiguration(); loadConfiguration();
// Setup interfaces // Setup interfaces
server = new SpoutServerInterface(this, getGame()); server = new SpoutServerInterface(this, getEngine());
controller = new WorldEdit(server, config); controller = new WorldEdit(server, config);
// Now we can register events! // Now we can register events!
registerEvents(); registerEvents();
getGame().getScheduler().scheduleAsyncRepeatingTask(this, getEngine().getScheduler().scheduleAsyncRepeatingTask(this,
new SessionTimer(controller, getGame()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST); new SessionTimer(controller, getEngine()), 6 * 1000, 6 * 1000, TaskPriority.LOWEST);
} }
/** /**
* Called on plugin disable. * Called on plugin disable.
*/ */
public void onDisable() { public void onDisable() {
for (Player player : getGame().getOnlinePlayers()) { for (Player player : getEngine().getOnlinePlayers()) {
LocalPlayer lPlayer = wrapPlayer(player); LocalPlayer lPlayer = wrapPlayer(player);
if (controller.getSession(lPlayer).hasCUISupport()) { if (controller.getSession(lPlayer).hasCUISupport()) {
lPlayer.dispatchCUIHandshake(); lPlayer.dispatchCUIHandshake();
@ -116,7 +115,7 @@ public class WorldEditPlugin extends CommonPlugin implements Named {
} }
controller.clearSessions(); controller.clearSessions();
config.unload(); 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. * Register the events used by WorldEdit.
*/ */
protected void registerEvents() { 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)); session.dispatchCUISelection(wrapPlayer(player));
} }
@Override
public String getName() {
return getDescription().getName();
}
static WorldEditPlugin getInstance() { static WorldEditPlugin getInstance() {
return instance; return instance;
} }