From 2ee056fb2bdc116888180a75ee5018c5548618e0 Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sat, 14 Dec 2019 22:33:55 +0200 Subject: [PATCH] Fix another error in command checker --- .../pw/kaboom/extras/modules/player/PlayerCommand.java | 10 ++++++---- .../pw/kaboom/extras/modules/server/ServerCommand.java | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java index 92d790f..e351663 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java @@ -44,10 +44,12 @@ class PlayerCommand implements Listener { final boolean isConsoleCommand = false; final String checkedCommand = ServerCommand.checkCommand(sender, command, isConsoleCommand); - if (checkedCommand.equals("cancel")) { - event.setCancelled(true); - } else if (checkedCommand != null) { - event.setMessage(checkedCommand); + if (checkedCommand != null) { + if (checkedCommand.equals("cancel")) { + event.setCancelled(true); + } else { + event.setMessage(checkedCommand); + } } } } diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java index ebffdba..40b7ea3 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java @@ -178,10 +178,12 @@ class ServerCommand implements Listener { final boolean isConsoleCommand = true; final String checkedCommand = checkCommand(sender, command, isConsoleCommand); - if (checkedCommand.equals("cancel")) { - event.setCancelled(true); - } else if (checkedCommand != null) { - event.setCommand(checkedCommand); + if (checkedCommand != null) { + if (checkedCommand.equals("cancel")) { + event.setCancelled(true); + } else { + event.setCommand(checkedCommand); + } } } }