From b85f55eca85aac185eb0a7fcca9f19dd4d610649 Mon Sep 17 00:00:00 2001 From: Adrian Date: Thu, 11 May 2023 22:51:29 -0500 Subject: [PATCH] fix: Fixed SyntaxCheck feedback --- .../plugin/listener/command/CommandListener.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 b68beac..6b6a317 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 @@ -6,7 +6,6 @@ import com.velocitypowered.api.event.command.CommandExecuteEvent; import com.velocitypowered.api.proxy.Player; import io.github._4drian3d.chatregulator.api.checks.*; -import io.github._4drian3d.chatregulator.api.enums.InfractionType; import io.github._4drian3d.chatregulator.api.enums.SourceType; import io.github._4drian3d.chatregulator.api.event.CommandInfractionEvent; import io.github._4drian3d.chatregulator.api.result.CheckResult; @@ -81,7 +80,8 @@ private boolean checkIfCanCheck(final String command) { }) .thenCompose(checkResult -> { if (checkResult.isDenied()) { - return CompletableFuture.completedFuture(CheckResult.denied(InfractionType.GLOBAL)); + final CheckResult.DeniedCheckresult deniedResult = (CheckResult.DeniedCheckresult) checkResult; + return CompletableFuture.completedFuture(CheckResult.denied(deniedResult.infractionType())); } if (!checkIfCanCheck(event.getCommand())) { @@ -107,10 +107,8 @@ private boolean checkIfCanCheck(final String command) { } else { if (result.isDenied()){ final CheckResult.DeniedCheckresult deniedResult = (CheckResult.DeniedCheckresult) result; - if (deniedResult.infractionType() != InfractionType.GLOBAL) { - eventManager.fireAndForget(new CommandInfractionEvent(infractionPlayer, deniedResult.infractionType(), result, event.getCommand())); - infractionPlayer.onDenied(deniedResult, event.getCommand()); - } + eventManager.fireAndForget(new CommandInfractionEvent(infractionPlayer, deniedResult.infractionType(), result, event.getCommand())); + infractionPlayer.onDenied(deniedResult, event.getCommand()); event.setResult(CommandExecuteEvent.CommandResult.denied()); continuation.resume(); }