From cb1f336d1438859c8ab6d15b3e494f17324105e8 Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 9 Mar 2023 18:56:09 +0100 Subject: [PATCH] Fix cancellation of PlayerChatEvent for key revision GENERIC_V1 (#941) --- .../protocol/packet/chat/keyed/KeyedChatHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/keyed/KeyedChatHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/keyed/KeyedChatHandler.java index 5cd7bdf4c..af4d25e0d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/keyed/KeyedChatHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/keyed/KeyedChatHandler.java @@ -104,9 +104,11 @@ public class KeyedChatHandler implements assert playerKey != null; return pme -> { PlayerChatEvent.ChatResult chatResult = pme.getResult(); - if (!chatResult.isAllowed() - && playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) { - invalidCancel(logger, player); + if (!chatResult.isAllowed()) { + if (playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) { + // Bad, very bad. + invalidCancel(logger, player); + } return null; }