From 4580d97f5e05ef3b8ed8cd53e3c3987f82d7a869 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:24:48 -0800 Subject: [PATCH] Fix deprecated bungee APIs still serializing to JSON in packets (#10028) --- patches/server/Player-Tab-List-and-Title-APIs.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/server/Player-Tab-List-and-Title-APIs.patch b/patches/server/Player-Tab-List-and-Title-APIs.patch index f4c45b3d3e..b7d7eeb653 100644 --- a/patches/server/Player-Tab-List-and-Title-APIs.patch +++ b/patches/server/Player-Tab-List-and-Title-APIs.patch @@ -10,16 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java @@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf { // TODO this.adventure$locale - return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.CODEC, io.papermc.paper.adventure.PaperAdventure.asVanilla(component)); + return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.CODEC, text); } -+ ++ // Paper start - deprecated Tab List & Title APIs + @Deprecated + public FriendlyByteBuf writeComponent(final net.md_5.bungee.api.chat.BaseComponent[] component) { -+ return this.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(component), 262144); ++ return this.writeComponent(java.util.Objects.requireNonNull(Component.Serializer.fromJson(net.md_5.bungee.chat.ComponentSerializer.toString(component)))); + } - // Paper end ++ // Paper end - deprecated Tab List & Title APIs - public FriendlyByteBuf writeComponent(Component text) { + public > T readEnum(Class enumClass) { + return ((T[]) enumClass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java