From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike Date: Tue, 8 Mar 2016 18:28:43 -0800 Subject: [PATCH] Don't nest if we don't need to when cerealising text components 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 bc7de641a37b2f4c8fe7ed8272c55a30ac4bc313..c47427fd2eed173726cb856aae62c02a2b46bbf0 100644 --- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java @@ -39,7 +39,14 @@ public class PacketPlayOutChat implements Packet { // Paper end // Spigot start if (components != null) { - packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); + //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])); + } else { + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components)); + } + // Paper end } else { packetdataserializer.a(this.a); }