From 4ccbb2cde2be71cf83ec540dba677a9f12680575 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 27 Oct 2020 07:29:08 -0400 Subject: [PATCH] Fix TabCompleteResponse not using Adventure to read tooltips. --- .../proxy/protocol/packet/TabCompleteResponse.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java index 859cda0a9..d63ac9279 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java @@ -10,8 +10,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -import net.kyori.text.Component; -import net.kyori.text.serializer.gson.GsonComponentSerializer; +import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; public class TabCompleteResponse implements MinecraftPacket { @@ -68,8 +67,8 @@ public class TabCompleteResponse implements MinecraftPacket { int offersAvailable = ProtocolUtils.readVarInt(buf); for (int i = 0; i < offersAvailable; i++) { String offer = ProtocolUtils.readString(buf); - Component tooltip = buf.readBoolean() ? GsonComponentSerializer.INSTANCE.deserialize( - ProtocolUtils.readString(buf)) : null; + Component tooltip = buf.readBoolean() ? ProtocolUtils.getJsonChatSerializer(version) + .deserialize(ProtocolUtils.readString(buf)) : null; offers.add(new Offer(offer, tooltip)); } } else { @@ -91,7 +90,8 @@ public class TabCompleteResponse implements MinecraftPacket { ProtocolUtils.writeString(buf, offer.text); buf.writeBoolean(offer.tooltip != null); if (offer.tooltip != null) { - ProtocolUtils.writeString(buf, GsonComponentSerializer.INSTANCE.serialize(offer.tooltip)); + ProtocolUtils.writeString(buf, ProtocolUtils.getJsonChatSerializer(version) + .serialize(offer.tooltip)); } } } else {