From 8995b64dc6a102b03966dfa5baab0e0f06c79bb6 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Thu, 22 Oct 2020 03:02:09 -0400 Subject: [PATCH] Do not use the GAME_INFO chat type. --- .../proxy/connection/client/ConnectedPlayer.java | 12 +++--------- .../velocitypowered/proxy/protocol/packet/Chat.java | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 27f705c54..2cad65f05 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -282,14 +282,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { @Override public void sendActionBar(net.kyori.adventure.text.@NonNull Component message) { ProtocolVersion playerVersion = getProtocolVersion(); - if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) { - // We do not need to use the title packets in 1.16.2+ - // https://bugs.mojang.com/browse/MC-119145 - Chat chat = Chat.createClientbound(Identity.nil(), message, getProtocolVersion()); - chat.setType(Chat.ACTION_TYPE); - connection.write(chat); - } else if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) { - // We can use the title packet instead. + if (playerVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) { + // Use the title packet instead. TitlePacket pkt = new TitlePacket(); pkt.setAction(TitlePacket.SET_ACTION_BAR); pkt.setComponent(ProtocolUtils.getJsonChatSerializer(playerVersion) @@ -302,7 +296,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { object.addProperty("text", LegacyComponentSerializer.legacySection().serialize(message)); Chat chat = new Chat(); chat.setMessage(object.toString()); - chat.setType(Chat.ACTION_TYPE); + chat.setType(Chat.GAME_INFO_TYPE); connection.write(chat); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java index 8fbbc0f7f..fd64ea600 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java @@ -15,7 +15,7 @@ public class Chat implements MinecraftPacket { public static final byte CHAT_TYPE = (byte) 0; public static final byte SYSTEM_TYPE = (byte) 1; - public static final byte ACTION_TYPE = (byte) 2; + public static final byte GAME_INFO_TYPE = (byte) 2; public static final int MAX_SERVERBOUND_MESSAGE_LENGTH = 256; public static final UUID EMPTY_SENDER = new UUID(0, 0);