From fe708ba0ebc3903820968d8580f0614a4d35edd9 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:58:44 +0200 Subject: [PATCH] Fix chat command handling --- .../Protocol1_20_3To1_20_5.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java index 94d952c6..63ecef13 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java @@ -122,7 +122,19 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol { + final String command = wrapper.passthrough(Type.STRING); // Command + wrapper.passthrough(Type.LONG); // Timestamp + wrapper.passthrough(Type.LONG); // Salt + final int signatures = wrapper.passthrough(Type.VAR_INT); // Signatures + if (signatures == 0) { + wrapper.cancel(); + + final PacketWrapper chatCommand = wrapper.create(ServerboundPackets1_20_5.CHAT_COMMAND); + chatCommand.write(Type.STRING, command); + chatCommand.sendToServer(Protocol1_20_3To1_20_5.class); + } + }); 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