From 6496983ca3b36db56b50cd3a9589c254460f5cfc Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 8 Aug 2022 00:42:31 -0400 Subject: [PATCH] Fix cancelling commands on <1.19 clients (#827) --- .../client/ClientPlaySessionHandler.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index afb2158ce..05d3925f4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -743,14 +743,16 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { @Nullable SignedChatCommand signedCommand, Instant passedTimestamp) { IdentifiedKey playerKey = player.getIdentifiedKey(); - if (result == CommandResult.denied() && playerKey != null) { - if (signedCommand != null && playerKey.getKeyRevision() - .compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) { - logger.fatal("A plugin tried to deny a command with signable component(s). " - + "This is not supported. " - + "Disconnecting player " + player.getUsername()); - player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. " - + "Contact your network administrator.")); + if (result == CommandResult.denied()) { + if (playerKey != null) { + if (signedCommand != null && playerKey.getKeyRevision() + .compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) { + logger.fatal("A plugin tried to deny a command with signable component(s). " + + "This is not supported. " + + "Disconnecting player " + player.getUsername()); + player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. " + + "Contact your network administrator.")); + } } return CompletableFuture.completedFuture(null); }