2021-06-11 14:02:28 +02:00
|
|
|
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/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
2021-11-24 02:53:24 +01:00
|
|
|
index a64780b4b49d01322d8f755ff540a9622c89e983..4047e177e3f336aa089ad7645ba8bd9e0863178e 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
|
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
2021-11-24 02:53:24 +01:00
|
|
|
@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.Packet;
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
2021-11-24 02:53:24 +01:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper
|
2021-06-13 11:41:07 +02:00
|
|
|
private final Component message;
|
2021-06-11 14:02:28 +02:00
|
|
|
public net.kyori.adventure.text.Component adventure$message; // Paper
|
|
|
|
public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot
|
2021-11-24 02:53:24 +01:00
|
|
|
@@ -39,9 +40,9 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
2021-06-13 11:41:07 +02:00
|
|
|
// buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
|
2021-06-11 14:02:28 +02:00
|
|
|
// Paper start - don't nest if we don't need to so that we can preserve formatting
|
|
|
|
if (this.components.length == 1) {
|
2021-06-13 11:41:07 +02:00
|
|
|
- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
|
2021-06-11 14:02:28 +02:00
|
|
|
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length
|
|
|
|
} else {
|
2021-06-13 11:41:07 +02:00
|
|
|
- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
|
2021-06-11 14:02:28 +02:00
|
|
|
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
} else {
|