aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0055-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch
blob: 77180fe309de70ef638a7838a13744a0b898b7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
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/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
index 9ae419f9ad971ee5c743ee931426ab482b6184f1..6ae26f8c3637e0c9e56ed3e14aaac0e3f781cb43 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
@@ -29,7 +29,14 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
     public void b(PacketDataSerializer packetdataserializer) throws IOException {
         // 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);
         }