From 9cfcfcf2ed5712e792114a3ab824670e25e23526 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 19 Nov 2024 20:49:17 +0300 Subject: [PATCH] Fix SystemChatPacket: Support reading packet properly in newer MC versions (#1461) --- .../proxy/protocol/packet/chat/SystemChatPacket.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/SystemChatPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/SystemChatPacket.java index 4224dc482..b36014d5b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/SystemChatPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/SystemChatPacket.java @@ -47,8 +47,11 @@ public class SystemChatPacket implements MinecraftPacket { @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { component = ComponentHolder.read(buf, version); - // System chat is never decoded so this doesn't matter for now - type = ChatType.values()[ProtocolUtils.readVarInt(buf)]; + if (version.noLessThan(ProtocolVersion.MINECRAFT_1_19_1)){ + type = buf.readBoolean() ? ChatType.GAME_INFO : ChatType.SYSTEM; + } else { + type = ChatType.values()[ProtocolUtils.readVarInt(buf)]; + } } @Override