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
*/
@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)) {

View File

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