From 33d4f608ba8128e3529daff9adf496f76d7543f5 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Mon, 22 Feb 2021 00:45:21 -0800 Subject: [PATCH] fix stupid legacy chat garbage --- Spigot-Server-Patches/0010-Adventure.patch | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/0010-Adventure.patch b/Spigot-Server-Patches/0010-Adventure.patch index 598c3eddbe..7cf8a57648 100644 --- a/Spigot-Server-Patches/0010-Adventure.patch +++ b/Spigot-Server-Patches/0010-Adventure.patch @@ -8,7 +8,7 @@ Co-authored-by: Jake Potrebic diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java new file mode 100644 -index 0000000000000000000000000000000000000000..0d1ae6b32a2ccae1e097371b5e0d9ec662865c2f +index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a4b4281b8 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java @@ -0,0 +1,78 @@ @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..0d1ae6b32a2ccae1e097371b5e0d9ec6 + this.wrapped = wrapped; + } + -+ IChatBaseComponent deepConverted() { ++ public IChatBaseComponent deepConverted() { + IChatBaseComponent converted = this.converted; + if (converted == null) { + converted = PaperAdventure.WRAPPER_AWARE_SERIALIZER.serialize(this.wrapped); @@ -2901,3 +2901,15 @@ index 0fba3d2a8d3bd7ec615d137e4625a7f357729d8d..b900aaf66f25e41956e7a4370b887fd4 @Override public String getDisplayName() throws IllegalStateException { +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +index 1582a799e456402453c43c2e0c6b8a194951a9dd..0dfb9ddad426e962db1216d1f490c1c5e2210adf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +@@ -290,6 +290,7 @@ public final class CraftChatMessage { + + public static String fromComponent(IChatBaseComponent component) { + if (component == null) return ""; ++ if (component instanceof io.papermc.paper.adventure.AdventureComponent) component = ((io.papermc.paper.adventure.AdventureComponent) component).deepConverted(); + StringBuilder out = new StringBuilder(); + + boolean hadFormat = false;