diff --git a/api/src/main/java/io/github/_4drian3d/chatregulator/api/checks/SyntaxCheck.java b/api/src/main/java/io/github/_4drian3d/chatregulator/api/checks/SyntaxCheck.java index 413042e..1973ceb 100644 --- a/api/src/main/java/io/github/_4drian3d/chatregulator/api/checks/SyntaxCheck.java +++ b/api/src/main/java/io/github/_4drian3d/chatregulator/api/checks/SyntaxCheck.java @@ -19,6 +19,7 @@ public final class SyntaxCheck implements Check { SyntaxCheck(Collection allowedCommands) { this.allowedCommands = allowedCommands; } + @Override public @NotNull CheckResult check(@NotNull InfractionPlayer player, @NotNull String string) { final String command = Commands.getFirstArgument(requireNonNull(string)); diff --git a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/listener/command/CommandListener.java b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/listener/command/CommandListener.java index b345f82..471f4b8 100644 --- a/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/listener/command/CommandListener.java +++ b/plugin/src/main/java/io/github/_4drian3d/chatregulator/plugin/listener/command/CommandListener.java @@ -75,7 +75,7 @@ private boolean checkIfCanCheck(final String command) { cooldownProvider ).detect(infractionPlayer, event.getCommand()) .exceptionally(ex -> { - logger.error("An error occurred while checking Command and Syntax", ex); + logger.error("An error occurred while checking initial command checks", ex); return CheckResult.allowed(); }) .thenCompose(checkResult -> { @@ -110,16 +110,17 @@ private boolean checkIfCanCheck(final String command) { infractionPlayer.onDenied(deniedResult, event.getCommand()); event.setResult(CommandExecuteEvent.CommandResult.denied()); continuation.resume(); + return null; } if (result.shouldModify()) { final CheckResult.ReplaceCheckResult replaceResult = (CheckResult.ReplaceCheckResult) result; final String replacedCommand = replaceResult.replaced(); infractionPlayer.getChain(SourceType.COMMAND).executed(replacedCommand); event.setResult(CommandExecuteEvent.CommandResult.command(replacedCommand)); - continuation.resume(); + } else { + infractionPlayer.getChain(SourceType.COMMAND).executed(event.getCommand()); + event.setResult(CommandExecuteEvent.CommandResult.allowed()); } - infractionPlayer.getChain(SourceType.COMMAND).executed(event.getCommand()); - event.setResult(CommandExecuteEvent.CommandResult.allowed()); continuation.resume(); } return null;