Fix another error in command checker

This commit is contained in:
mathiascode 2019-12-14 22:33:55 +02:00
parent 9e967c9748
commit 2ee056fb2b
2 changed files with 12 additions and 8 deletions

View file

@ -44,10 +44,12 @@ class PlayerCommand implements Listener {
final boolean isConsoleCommand = false; final boolean isConsoleCommand = false;
final String checkedCommand = ServerCommand.checkCommand(sender, command, isConsoleCommand); final String checkedCommand = ServerCommand.checkCommand(sender, command, isConsoleCommand);
if (checkedCommand != null) {
if (checkedCommand.equals("cancel")) { if (checkedCommand.equals("cancel")) {
event.setCancelled(true); event.setCancelled(true);
} else if (checkedCommand != null) { } else {
event.setMessage(checkedCommand); event.setMessage(checkedCommand);
} }
} }
} }
}

View file

@ -178,10 +178,12 @@ class ServerCommand implements Listener {
final boolean isConsoleCommand = true; final boolean isConsoleCommand = true;
final String checkedCommand = checkCommand(sender, command, isConsoleCommand); final String checkedCommand = checkCommand(sender, command, isConsoleCommand);
if (checkedCommand != null) {
if (checkedCommand.equals("cancel")) { if (checkedCommand.equals("cancel")) {
event.setCancelled(true); event.setCancelled(true);
} else if (checkedCommand != null) { } else {
event.setCommand(checkedCommand); event.setCommand(checkedCommand);
} }
} }
} }
}