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.equals("cancel")) { if (checkedCommand != null) {
event.setCancelled(true); if (checkedCommand.equals("cancel")) {
} else if (checkedCommand != null) { event.setCancelled(true);
event.setMessage(checkedCommand); } else {
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.equals("cancel")) { if (checkedCommand != null) {
event.setCancelled(true); if (checkedCommand.equals("cancel")) {
} else if (checkedCommand != null) { event.setCancelled(true);
event.setCommand(checkedCommand); } else {
event.setCommand(checkedCommand);
}
} }
} }
} }