Skip to content

Commit

Permalink
Backward compatibility for compat DisconnectPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Aug 7, 2024
1 parent 7f0e7fb commit 02581c8
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand All @@ -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));
}
}
}
}

0 comments on commit 02581c8

Please sign in to comment.