From a273a86a7d1169ddff64c0eed672df65fab0389d Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 19 Feb 2011 17:54:47 -0800 Subject: [PATCH] Updated WorldEdit for command preprocessor event, changed initialization. --- .../bukkit/WorldEditPlayerListener.java | 3 +- .../worldedit/bukkit/WorldEditPlugin.java | 30 ++++++++----------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java index 5caa008ea..8fa2ed9b4 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java @@ -30,7 +30,6 @@ import org.bukkit.event.player.PlayerListener; /** * Handles all events thrown in relation to a Player */ -@SuppressWarnings("deprecation") public class WorldEditPlayerListener extends PlayerListener { /** * Plugin. @@ -74,7 +73,7 @@ public class WorldEditPlayerListener extends PlayerListener { * @param event Relevant event details */ @Override - public void onPlayerCommand(PlayerChatEvent event) { + public void onPlayerCommandPreprocess(PlayerChatEvent event) { String[] split = event.getMessage().split(" "); if (plugin.controller.handleCommand(wrapPlayer(event.getPlayer()), split)) { diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index bf0398812..97fef3a95 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -47,26 +47,23 @@ import com.sk89q.worldedit.regions.Region; public class WorldEditPlugin extends JavaPlugin { private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit"); - final ServerInterface server; - final WorldEdit controller; - final WorldEditAPI api; + ServerInterface server; + WorldEdit controller; + WorldEditAPI api; - private final BukkitConfiguration config; - private final PermissionsResolverManager perms; + private BukkitConfiguration config; + private PermissionsResolverManager perms; - private final WorldEditPlayerListener playerListener = + private WorldEditPlayerListener playerListener = new WorldEditPlayerListener(this); - private final WorldEditBlockListener blockListener = + private WorldEditBlockListener blockListener = new WorldEditBlockListener(this); - private final PermissionsResolverServerListener permsListener; + private PermissionsResolverServerListener permsListener; - public WorldEditPlugin(PluginLoader pluginLoader, Server instance, - PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { - super(pluginLoader, instance, desc, folder, plugin, cLoader); - - logger.info("WorldEdit " + desc.getVersion() + " loaded."); + public void onEnable() { + logger.info("WorldEdit " + getDescription().getVersion() + " loaded."); - folder.mkdirs(); + getDataFolder().mkdirs(); createDefaultConfiguration("config.yml"); @@ -83,9 +80,6 @@ public class WorldEditPlugin extends JavaPlugin { registerEvents(); } - public void onEnable() { - } - public void onDisable() { controller.clearSessions(); } @@ -97,7 +91,7 @@ public class WorldEditPlugin extends JavaPlugin { playerListener, Priority.Normal, this); getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal, this); - getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, + getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Normal, this); getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);