Updated for SpoutAPI changes

Dieser Commit ist enthalten in:
zml2008 2012-06-30 16:54:31 -07:00
Ursprung 7bc66b8247
Commit fd1b15c5da
2 geänderte Dateien mit 8 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -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;
} }

Datei anzeigen

@ -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;
} }