From d2ca6a82be97ecce0b6cc0fd1970b79f2784a42a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 24 Apr 2024 10:26:35 +0200 Subject: [PATCH] Assume enforce secure chat as false by default Setting it to true will result in chat validation errors on the client for other players without chat sessions or valid signatures --- .../rewriter/EntityPacketRewriter1_20_5.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java index 687e52f11..2dd805c6b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java @@ -210,9 +210,15 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { // Enforces secure chat - moved from server data (which is unfortunately sent a while after this) - // Just put in what we know if this is sent multiple times final AcknowledgedMessagesStorage storage = wrapper.user().get(AcknowledgedMessagesStorage.class); - wrapper.write(Type.BOOLEAN, storage.isSecureChatEnforced()); + if (storage.secureChatEnforced() != null) { + // Just put in what we know if this is sent multiple times + wrapper.write(Type.BOOLEAN, storage.isSecureChatEnforced()); + } else { + // Assume that it isn't, otherwise the client will disregard chat messages from players + // without chat sessions if it assumes secure chat is enforced + wrapper.write(Type.BOOLEAN, false); + } storage.clear();