Fix NPE on teleports. Show NoCheat commands to everybody who at least

has permission for one of the commands.
This commit is contained in:
Evenprime 2011-12-24 01:31:41 +01:00
parent de0530a231
commit c3a429ca10
4 changed files with 20 additions and 11 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cc.co.evenprime.bukkit</groupId>
<artifactId>NoCheat</artifactId>
<version>2.22</version>
<version>2.22a</version>
<packaging>jar</packaging>
<name>NoCheat</name>
<properties>

View File

@ -142,11 +142,6 @@ public class NoCheat extends JavaPlugin {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
boolean result = CommandHandler.handleCommand(this, sender, command, label, args);
if(!result && sender instanceof Player) {
sender.sendMessage("Unknown command. Type \"help\" for help.");
return true;
}
return result;
}

View File

@ -16,11 +16,20 @@ public class CCInventory implements ConfigItem {
public CCInventory(Configuration data) {
check = data.getBoolean(Configuration.INVENTORY_CHECK);
dropCheck = data.getBoolean(Configuration.INVENTORY_DROP_CHECK);
dropTimeFrame = data.getInteger(Configuration.INVENTORY_DROP_TIMEFRAME);
dropLimit = data.getInteger(Configuration.INVENTORY_DROP_LIMIT);
dropActions = data.getActionList(Configuration.INVENTORY_DROP_ACTIONS);
/*
* check = data.getBoolean(Configuration.INVENTORY_CHECK);
* dropCheck = data.getBoolean(Configuration.INVENTORY_DROP_CHECK);
* dropTimeFrame =
* data.getInteger(Configuration.INVENTORY_DROP_TIMEFRAME);
* dropLimit = data.getInteger(Configuration.INVENTORY_DROP_LIMIT);
* dropActions =
* data.getActionList(Configuration.INVENTORY_DROP_ACTIONS);
*/
check = false;
dropCheck = false;
dropTimeFrame = 0;
dropLimit = 0;
dropActions = null;
closebeforeteleports = data.getBoolean(Configuration.INVENTORY_PREVENTITEMDUPE);
}

View File

@ -23,6 +23,11 @@ public class CommandHandler {
public static boolean handleCommand(NoCheat plugin, CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player && !sender.hasPermission(Permissions.ADMIN_PLAYERINFO) && !sender.hasPermission(Permissions.ADMIN_PERMLIST) && !sender.hasPermission(Permissions.ADMIN_RELOAD) && !sender.hasPermission(Permissions.ADMIN_PERFORMANCE)) {
sender.sendMessage("Unknown command. Type \"help\" for help.");
return true;
}
boolean result = false;
// Not our command
if(!command.getName().equalsIgnoreCase("nocheat") || args.length == 0) {