Fix command restrict

This commit is contained in:
Shevchik 2013-12-16 10:21:41 +04:00
parent 015021bbf0
commit 4810eb0ac4

View File

@ -20,13 +20,14 @@ public class CommandRestrict implements Listener {
String playercommand = event.getMessage().toLowerCase(); String playercommand = event.getMessage().toLowerCase();
if (plugin.sit.containsKey(player.getName())) if (plugin.sit.containsKey(player.getName()))
{ {
if (plugin.sitDisableAllCommands)
{
event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted);
return;
}
for (String disabledCommand : plugin.sitDisabledCommands) for (String disabledCommand : plugin.sitDisabledCommands)
{ {
if (plugin.sitDisableAllCommands)
{
event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted);
} else
if (disabledCommand.startsWith(playercommand)) if (disabledCommand.startsWith(playercommand))
{ {
String therest = disabledCommand.replace(playercommand, ""); String therest = disabledCommand.replace(playercommand, "");
@ -34,6 +35,7 @@ public class CommandRestrict implements Listener {
{ {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted); player.sendMessage(plugin.msgCommandRestricted);
return;
} }
} }
} }