Fix cancelling commands on <1.19 clients (#827)

This commit is contained in:
Andrew Steinborn
2022-08-08 00:42:31 -04:00
parent 0b22985f4b
commit 6496983ca3

View File

@@ -743,7 +743,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Nullable SignedChatCommand signedCommand, @Nullable SignedChatCommand signedCommand,
Instant passedTimestamp) { Instant passedTimestamp) {
IdentifiedKey playerKey = player.getIdentifiedKey(); IdentifiedKey playerKey = player.getIdentifiedKey();
if (result == CommandResult.denied() && playerKey != null) { if (result == CommandResult.denied()) {
if (playerKey != null) {
if (signedCommand != null && playerKey.getKeyRevision() if (signedCommand != null && playerKey.getKeyRevision()
.compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) { .compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
logger.fatal("A plugin tried to deny a command with signable component(s). " logger.fatal("A plugin tried to deny a command with signable component(s). "
@@ -752,6 +753,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. " player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator.")); + "Contact your network administrator."));
} }
}
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
} }