Change commandmanager to cancel event if command is registered, despite not having permissions

This commit is contained in:
libraryaddict 2015-02-10 02:20:54 +13:00
parent 219ac93dc4
commit cf0134a577

View File

@ -58,19 +58,20 @@ public class CommandCenter implements Listener
ICommand command = Commands.get(commandName.toLowerCase()); ICommand command = Commands.get(commandName.toLowerCase());
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true)) if (command != null)
{ {
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false)) if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
{ {
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast.")); if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
event.setCancelled(true); {
return; event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
} return;
}
command.SetAliasUsed(commandName.toLowerCase()); command.SetAliasUsed(commandName.toLowerCase());
command.Execute(event.getPlayer(), args); command.Execute(event.getPlayer(), args);
}
event.setCancelled(true); event.setCancelled(true);
} }
} }