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
1 changed files with 13 additions and 12 deletions

View File

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