Skip to content

Commit

Permalink
fix: Fixed SyntaxCheck feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed May 12, 2023
1 parent fcd2ecb commit b85f55e
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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())) {
Expand All @@ -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();
}
Expand Down

0 comments on commit b85f55e

Please sign in to comment.