mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Use proper max length when serialising BungeeCord text component
This commit is contained in:
parent
7e331bdc72
commit
c752d3a80d
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
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
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
--
|
Loading…
Reference in a new issue