Paper/Spigot-Server-Patches/0336-Use-proper-max-length-when-serialising-BungeeCord-te.patch
Aikar c953e51dd7
[Auto] Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
221aed6cf SPIGOT-6413: Server Corruption Changing Blocks in Piston Events
721c4966b SPIGOT-6411: The PlayerEditBookEvent is not called when the player edits a book in the off-hand.
be0e94581 Add mc-dev imports

Spigot Changes:
a25e8ed2 Remove mc-dev imports
2021-04-07 01:17:32 -04:00

33 lines
2.0 KiB
Diff

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/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
index f6a1c5ac9acb34b1ef2262721adbbb1a5b0feaf7..fefcacf27d71c67403555502685a992a5a706099 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
@@ -9,7 +9,7 @@ import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.Packet;
public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
-
+ 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
@@ -43,9 +43,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 {