From 2e4520d902bb75dc11fc0f57d715b0b526337d77 Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 20 Mar 2019 21:20:56 -0700 Subject: [PATCH] Use proper max length when serialising BungeeCord text component --- .../0085-EntityPathfindEvent.patch | 4 +-- ...ength-when-serialising-BungeeCord-te.patch | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 Spigot-Server-Patches/0422-Use-proper-max-length-when-serialising-BungeeCord-te.patch diff --git a/Spigot-Server-Patches/0085-EntityPathfindEvent.patch b/Spigot-Server-Patches/0085-EntityPathfindEvent.patch index e8ae17bda7..c857098d68 100644 --- a/Spigot-Server-Patches/0085-EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/0085-EntityPathfindEvent.patch @@ -1,4 +1,4 @@ -From 66f0c7791596f3d0e726a47caa3b4c38056110c2 Mon Sep 17 00:00:00 2001 +From f8da455661efa320cd90dd6a41195b8a0c29bc3e Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 21:22:26 -0400 Subject: [PATCH] EntityPathfindEvent @@ -35,5 +35,5 @@ index 60b5068e3..604049b08 100644 float f = this.j(); -- -2.20.1 +2.21.0 diff --git a/Spigot-Server-Patches/0422-Use-proper-max-length-when-serialising-BungeeCord-te.patch b/Spigot-Server-Patches/0422-Use-proper-max-length-when-serialising-BungeeCord-te.patch new file mode 100644 index 0000000000..d6e5090f83 --- /dev/null +++ b/Spigot-Server-Patches/0422-Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -0,0 +1,35 @@ +From eafb2cc37ab642330de42277e7e84bcb504988ea Mon Sep 17 00:00:00 2001 +From: kashike +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 eba6aadad..3a332e980 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -3,7 +3,7 @@ package net.minecraft.server; + import java.io.IOException; + + public class PacketPlayOutChat implements Packet { +- ++ 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; +@@ -30,9 +30,9 @@ 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 { +-- +2.21.0 +