Add more blocked commands and move the blocked command handler below the Mineplex command executor

This commit is contained in:
AlexTheCoder 2016-10-27 05:36:17 -04:00 committed by Shaun Bennett
parent 4cb257e84a
commit d5f89bb370

View File

@ -22,7 +22,7 @@ public class CommandCenter implements Listener
protected JavaPlugin Plugin;
protected CoreClientManager ClientManager;
protected static NautHashMap<String, ICommand> Commands;
private final List<String> BLOCKED_COMMANDS = Lists.newArrayList("pl", "plugins", "ver", "version", "icanhasbukkit");
private final List<String> BLOCKED_COMMANDS = Lists.newArrayList("pl", "plugins", "ver", "version", "icanhasbukkit", "about", "?", "help");
private final String MESSAGE = C.cRed + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.";
public static void Initialize(JavaPlugin plugin)
@ -60,13 +60,6 @@ public class CommandCenter implements Listener
args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
}
if (BLOCKED_COMMANDS.contains(commandName.toLowerCase()) && !(event.getPlayer().isOp() || ClientManager.Get(event.getPlayer()).GetRank().has(Rank.DEVELOPER)))
{
event.setCancelled(true);
event.getPlayer().sendMessage(MESSAGE);
return;
}
ICommand command = Commands.get(commandName.toLowerCase());
if (command != null)
@ -86,6 +79,13 @@ public class CommandCenter implements Listener
command.Execute(event.getPlayer(), args);
}
}
if (BLOCKED_COMMANDS.contains(commandName.toLowerCase()) && !(event.getPlayer().isOp() || ClientManager.Get(event.getPlayer()).GetRank().has(Rank.DEVELOPER)))
{
event.setCancelled(true);
event.getPlayer().sendMessage(MESSAGE);
return;
}
}