36 Zeilen
1.8 KiB
Diff
36 Zeilen
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: kashike <kashike@vq.lc>
|
|
Date: Tue, 8 Mar 2016 18:28:43 -0800
|
|
Subject: [PATCH] Don't nest if we don't need to when cerealising text
|
|
components
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java
|
|
index cfcdb21f48f74ea1638907e966f06c4aee072d34..365cf8486d690029a48b771a6186118a28eba7d4 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSystemChatPacket.java
|
|
@@ -16,7 +16,7 @@ public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.a
|
|
}
|
|
|
|
public ClientboundSystemChatPacket(net.md_5.bungee.api.chat.BaseComponent[] content, int typeId) {
|
|
- this(null, net.md_5.bungee.chat.ComponentSerializer.toString(content), typeId); // Paper - Adventure
|
|
+ this(null, improveBungeeComponentSerialization(content), typeId); // Paper - Adventure & don't nest if we don't need to so that we can preserve formatting
|
|
}
|
|
// Spigot end
|
|
// Paper start
|
|
@@ -27,6 +27,14 @@ public record ClientboundSystemChatPacket(@javax.annotation.Nullable net.kyori.a
|
|
public ClientboundSystemChatPacket(net.kyori.adventure.text.Component content, int typeId) {
|
|
this(content, null, typeId);
|
|
}
|
|
+
|
|
+ private static String improveBungeeComponentSerialization(net.md_5.bungee.api.chat.BaseComponent[] content) {
|
|
+ if (content.length == 1) {
|
|
+ return net.md_5.bungee.chat.ComponentSerializer.toString(content[0]);
|
|
+ } else {
|
|
+ return net.md_5.bungee.chat.ComponentSerializer.toString(content);
|
|
+ }
|
|
+ }
|
|
// Paper end
|
|
|
|
public ClientboundSystemChatPacket(FriendlyByteBuf buf) {
|