Updated WorldEdit for command preprocessor event, changed initialization.

This commit is contained in:
sk89q 2011-02-19 17:54:47 -08:00
parent a0d5e02292
commit a273a86a7d
2 changed files with 13 additions and 20 deletions

View File

@ -30,7 +30,6 @@ import org.bukkit.event.player.PlayerListener;
/** /**
* Handles all events thrown in relation to a Player * Handles all events thrown in relation to a Player
*/ */
@SuppressWarnings("deprecation")
public class WorldEditPlayerListener extends PlayerListener { public class WorldEditPlayerListener extends PlayerListener {
/** /**
* Plugin. * Plugin.
@ -74,7 +73,7 @@ public class WorldEditPlayerListener extends PlayerListener {
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override @Override
public void onPlayerCommand(PlayerChatEvent event) { public void onPlayerCommandPreprocess(PlayerChatEvent event) {
String[] split = event.getMessage().split(" "); String[] split = event.getMessage().split(" ");
if (plugin.controller.handleCommand(wrapPlayer(event.getPlayer()), split)) { if (plugin.controller.handleCommand(wrapPlayer(event.getPlayer()), split)) {

View File

@ -47,26 +47,23 @@ import com.sk89q.worldedit.regions.Region;
public class WorldEditPlugin extends JavaPlugin { public class WorldEditPlugin extends JavaPlugin {
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit"); private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
final ServerInterface server; ServerInterface server;
final WorldEdit controller; WorldEdit controller;
final WorldEditAPI api; WorldEditAPI api;
private final BukkitConfiguration config; private BukkitConfiguration config;
private final PermissionsResolverManager perms; private PermissionsResolverManager perms;
private final WorldEditPlayerListener playerListener = private WorldEditPlayerListener playerListener =
new WorldEditPlayerListener(this); new WorldEditPlayerListener(this);
private final WorldEditBlockListener blockListener = private WorldEditBlockListener blockListener =
new WorldEditBlockListener(this); new WorldEditBlockListener(this);
private final PermissionsResolverServerListener permsListener; private PermissionsResolverServerListener permsListener;
public WorldEditPlugin(PluginLoader pluginLoader, Server instance, public void onEnable() {
PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) { logger.info("WorldEdit " + getDescription().getVersion() + " loaded.");
super(pluginLoader, instance, desc, folder, plugin, cLoader);
logger.info("WorldEdit " + desc.getVersion() + " loaded."); getDataFolder().mkdirs();
folder.mkdirs();
createDefaultConfiguration("config.yml"); createDefaultConfiguration("config.yml");
@ -83,9 +80,6 @@ public class WorldEditPlugin extends JavaPlugin {
registerEvents(); registerEvents();
} }
public void onEnable() {
}
public void onDisable() { public void onDisable() {
controller.clearSessions(); controller.clearSessions();
} }
@ -97,7 +91,7 @@ public class WorldEditPlugin extends JavaPlugin {
playerListener, Priority.Normal, this); playerListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM, getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ITEM,
playerListener, Priority.Normal, this); playerListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS,
playerListener, Priority.Normal, this); playerListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED, getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
blockListener, Priority.Normal, this); blockListener, Priority.Normal, this);