Removed onPlayerCommand (PLAYER_COMMAND) (and fixed Fillr to stop using it)

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot
2011-02-26 19:08:12 +00:00
parent 1da9ef3c9f
commit 1595230d40
9 changed files with 63 additions and 105 deletions

View File

@@ -1,14 +1,10 @@
package org.bukkit.fillr;
import org.bukkit.*;
import org.bukkit.plugin.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.*;
import org.bukkit.event.*;
import java.io.File;
public class Fillr extends JavaPlugin {
private FillrListener listener;
public static final String NAME = "Fillr";
public static final String VERSION = "1.0";
public static final String DIRECTORY = "plugins";
@@ -17,11 +13,38 @@ public class Fillr extends JavaPlugin {
}
public void onEnable() {
registerEvents();
}
private void registerEvents() {
listener = new FillrListener(getServer());
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, listener, Event.Priority.Normal, this);
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (commandLabel.equalsIgnoreCase("check")) {
new Checker().check(sender);
return true;
} else if (commandLabel.equalsIgnoreCase("updateAll")) {
new Updater(getServer()).updateAll(sender);
return true;
} else if (commandLabel.equalsIgnoreCase("update")) {
if (args.length == 0) {
sender.sendMessage("Usage is /update <name>");
} else {
new Updater(getServer()).update(args[0], sender);
}
return true;
} else if (commandLabel.equalsIgnoreCase("get")) {
if (args.length == 0) {
sender.sendMessage("Usage is /get <name>");
} else {
try {
new Getter(getServer()).get(args[0], sender);
} catch (Exception e) {
sender.sendMessage("There was an error downloading " + args[0]);
}
}
return true;
}
return false;
}
}