From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Wed, 20 Mar 2019 21:19:29 -0700 Subject: [PATCH] Use proper max length when serialising BungeeCord text component diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java @@ -0,0 +0,0 @@ import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.network.protocol.Packet; public class PacketPlayOutChat implements Packet { - + private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper private IChatBaseComponent a; public net.kyori.adventure.text.Component adventure$message; // Paper public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot @@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet { //packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below // Paper start - don't nest if we don't need to so that we can preserve formatting if (this.components.length == 1) { - packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0])); + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length } else { - packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components)); + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length } // Paper end } else {