3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 23:30:26 +01:00

Fix TabCompleteResponse not using Adventure to read tooltips.

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-10-27 07:29:08 -04:00
Ursprung 911aba1b45
Commit 4ccbb2cde2

Datei anzeigen

@ -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 {