aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0343-Use-proper-max-length-when-serialising-BungeeCord-te.patch
blob: 2918d2ee68bc167fd8491ac7cc2822d3343cf541 (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
28
29
30
31
32
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
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/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
index 6ae26f8c3637e0c9e56ed3e14aaac0e3f781cb43..b9b2ddc1acadb96a0c750aeba0c0f6928f74e2fe 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
@@ -4,7 +4,7 @@ import java.io.IOException;
 import java.util.UUID;
 
 public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
-
+    private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper
     private IChatBaseComponent a;
     public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot
     private ChatMessageType b;
@@ -32,9 +32,9 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
             //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 {