From 02581c877dd774ea29f2097b70b12951ba0acf79 Mon Sep 17 00:00:00 2001 From: Alemiz Date: Wed, 7 Aug 2024 16:54:26 +0200 Subject: [PATCH] Backward compatibility for compat DisconnectPacket --- .../codec/compat/serializer/DisconnectSerializerCompat.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/serializer/DisconnectSerializerCompat.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/serializer/DisconnectSerializerCompat.java index f6dca303c..bb9955bb9 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/serializer/DisconnectSerializerCompat.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/compat/serializer/DisconnectSerializerCompat.java @@ -20,6 +20,7 @@ public void serialize(ByteBuf buffer, BedrockCodecHelper helper, DisconnectPacke buffer.writeBoolean(packet.isMessageSkipped()); if (!packet.isMessageSkipped()) { helper.writeString(buffer, packet.getKickMessage()); + helper.writeString(buffer, packet.getFilteredMessage()); } } @@ -31,6 +32,9 @@ public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, DisconnectPac packet.setMessageSkipped(buffer.readBoolean()); if (!packet.isMessageSkipped()) { packet.setKickMessage(helper.readString(buffer)); + if (buffer.isReadable()) { // backwards compatibility + packet.setFilteredMessage(helper.readString(buffer)); + } } } }