geforkt von Mirrors/Paper
33 Zeilen
2.0 KiB
Diff
33 Zeilen
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/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||
|
index f13da9e7d014bc00fbabf0a495b548bba2f59468..002a6c7933f64405707d7d34d3e5c17584539623 100644
|
||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||
|
@@ -9,7 +9,7 @@ import net.minecraft.network.chat.Component;
|
||
|
import net.minecraft.network.protocol.Packet;
|
||
|
|
||
|
public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
||
|
-
|
||
|
+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper
|
||
|
private Component message;
|
||
|
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 ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
||
|
//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) {
|
||
|
- buf.writeByteArray(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
|
||
|
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length
|
||
|
} else {
|
||
|
- buf.writeByteArray(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
|
||
|
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length
|
||
|
}
|
||
|
// Paper end
|
||
|
} else {
|