From a597c7d68725b39147b994b042987c589f222143 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Tue, 9 Mar 2021 09:27:12 -0800 Subject: [PATCH] legacy formatting is worse than walking around in wet socks --- Spigot-Server-Patches/Adventure.patch | 10 ++++++++-- .../Player-Tab-List-and-Title-APIs.patch | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Adventure.patch b/Spigot-Server-Patches/Adventure.patch index 6db850dc80..2840ae1526 100644 --- a/Spigot-Server-Patches/Adventure.patch +++ b/Spigot-Server-Patches/Adventure.patch @@ -463,6 +463,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.NBTTagList; +import net.minecraft.server.NBTTagString; +import net.minecraft.server.SoundCategory; ++import org.bukkit.ChatColor; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + @@ -609,6 +610,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return IChatBaseComponent.ChatSerializer.componentToJson(component); + } + ++ // thank you for being worse than wet socks, Bukkit ++ public static String superHackyLegacyRepresentationOfComponent(final Component component, final String string) { ++ return LEGACY_SECTION_UXRC.serialize(component) + ChatColor.getLastColors(string); ++ } ++ + // BossBar + + public static BossBattle.BarColor asVanilla(final BossBar.Color color) { @@ -2039,13 +2045,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public String getDisplayName() { -+ if(true) return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.getHandle().adventure$displayName); // Paper ++ if(true) return io.papermc.paper.adventure.PaperAdventure.superHackyLegacyRepresentationOfComponent(this.getHandle().adventure$displayName, this.getHandle().displayName); // Paper return getHandle().displayName; } @Override public void setDisplayName(final String name) { -+ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); if (true) return; // Paper ++ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); // Paper getHandle().displayName = name == null ? getName() : name; } diff --git a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index 0d7b2a2f86..c552ff3860 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -170,4 +170,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public String getDisplayName() { - if(true) return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.getHandle().adventure$displayName); // Paper + if(true) return io.papermc.paper.adventure.PaperAdventure.superHackyLegacyRepresentationOfComponent(this.getHandle().adventure$displayName, this.getHandle().displayName); // Paper