Fix command restrict

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

View File

@ -19,14 +19,15 @@ public class CommandRestrict implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
String playercommand = event.getMessage().toLowerCase(); String playercommand = event.getMessage().toLowerCase();
if (plugin.sit.containsKey(player.getName())) if (plugin.sit.containsKey(player.getName()))
{
for (String disabledCommand : plugin.sitDisabledCommands)
{ {
if (plugin.sitDisableAllCommands) if (plugin.sitDisableAllCommands)
{ {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted); player.sendMessage(plugin.msgCommandRestricted);
} else return;
}
for (String disabledCommand : plugin.sitDisabledCommands)
{
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;
} }
} }
} }