From eb4d30ae739f68273d709c38b492b3e5b65cc6ce Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 15 Aug 2024 13:35:37 +0200 Subject: [PATCH] Always map command to signed command in 1.20.5->1.20.3 Sending any message, any non-message command, and again any message would kick the client with a chat validation error. Let's see if this is better --- .../v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java index c2514dbc..2003fb28 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_20_5to1_20_3/Protocol1_20_5To1_20_3.java @@ -124,19 +124,8 @@ public final class Protocol1_20_5To1_20_3 extends BackwardsProtocol { - final String command = wrapper.passthrough(Types.STRING); // Command - wrapper.passthrough(Types.LONG); // Timestamp - wrapper.passthrough(Types.LONG); // Salt - final int signatures = wrapper.passthrough(Types.VAR_INT); // Signatures - if (signatures == 0) { - wrapper.cancel(); - - final PacketWrapper chatCommand = wrapper.create(ServerboundPackets1_20_5.CHAT_COMMAND); - chatCommand.write(Types.STRING, command); - chatCommand.sendToServer(Protocol1_20_5To1_20_3.class); - } - }); + // Always write as signed, even if there is 0 signatures attached, else the validation chain gets broken + registerServerbound(ServerboundPackets1_20_3.CHAT_COMMAND, ServerboundPackets1_20_5.CHAT_COMMAND_SIGNED); registerClientbound(State.LOGIN, ClientboundLoginPackets.COOKIE_REQUEST.getId(), -1, wrapper -> handleCookieRequest(wrapper, ServerboundLoginPackets.COOKIE_RESPONSE)); cancelClientbound(ClientboundConfigurationPackets1_20_5.RESET_CHAT); // Old clients already reset chat when entering the configuration phase