From 60e92c061b01295a4ef2b21272de75bd6a33f11b Mon Sep 17 00:00:00 2001 From: Riley Park Date: Tue, 2 Mar 2021 08:39:36 -0800 Subject: [PATCH] fix #5292 with help from @JRoy --- Spigot-Server-Patches/0010-Adventure.patch | 19 +++++++++++-------- ...nilla-per-world-scoreboard-coloring-.patch | 6 +++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Spigot-Server-Patches/0010-Adventure.patch b/Spigot-Server-Patches/0010-Adventure.patch index 667e3d12f..fd5d0af1d 100644 --- a/Spigot-Server-Patches/0010-Adventure.patch +++ b/Spigot-Server-Patches/0010-Adventure.patch @@ -106,16 +106,17 @@ index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a +} diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a309d0fb7 +index 0000000000000000000000000000000000000000..a8bc84d476093e6b39564450564f676adccde898 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -0,0 +1,209 @@ +@@ -0,0 +1,212 @@ +package io.papermc.paper.adventure; + +import io.papermc.paper.chat.ChatFormatter; +import io.papermc.paper.event.player.AbstractChatEvent; +import io.papermc.paper.event.player.AsyncChatEvent; +import io.papermc.paper.event.player.ChatEvent; ++import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.function.Consumer; +import java.util.regex.Pattern; @@ -171,6 +172,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a + event -> { + final AsyncChatEvent ae = this.createAsync( + legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()), ++ event.getRecipients(), + PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()) + ); + ae.setCancelled(event.isCancelled()); // propagate cancelled state @@ -188,6 +190,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a + protected Void evaluate() { + final ChatEvent se = ChatProcessor.this.createSync( + legacyFormatter(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()), ++ event.getRecipients(), + PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()) + ); + se.setCancelled(event.isCancelled()); // propagate cancelled state @@ -199,7 +202,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a + }, + // no legacy events called, all nice and fresh! + () -> { -+ final AsyncChatEvent ae = this.createAsync(ChatFormatter.DEFAULT, Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG)); ++ final AsyncChatEvent ae = this.createAsync(ChatFormatter.DEFAULT, new LazyPlayerSet(this.server), Component.text(this.message).replaceText(URL_REPLACEMENT_CONFIG)); + post(ae); + if (listenersOnSyncEvent) { + this.continueWithSyncFromWhereAsyncLeftOff(ae); @@ -222,7 +225,7 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a + this.queueIfAsyncOrRunImmediately(new Waitable() { + @Override + protected Void evaluate() { -+ final ChatEvent se = ChatProcessor.this.createSync(ae.formatter(), ae.message()); ++ final ChatEvent se = ChatProcessor.this.createSync(ae.formatter(), ae.recipients(), ae.message()); + se.setCancelled(ae.isCancelled()); // propagate cancelled state + post(se); + ChatProcessor.this.complete(se); @@ -257,12 +260,12 @@ index 0000000000000000000000000000000000000000..d7945e7340f406fbf21a1bd67f9c167a + } + } + -+ private AsyncChatEvent createAsync(final ChatFormatter formatter, final Component message) { -+ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), new LazyPlayerSet(this.server), formatter, message); ++ private AsyncChatEvent createAsync(final ChatFormatter formatter, final Set recipients, final Component message) { ++ return new AsyncChatEvent(this.async, this.player.getBukkitEntity(), recipients, formatter, message); + } + -+ private ChatEvent createSync(final ChatFormatter formatter, final Component message) { -+ return new ChatEvent(this.player.getBukkitEntity(), new LazyPlayerSet(this.server), formatter, message); ++ private ChatEvent createSync(final ChatFormatter formatter, final Set recipients, final Component message) { ++ return new ChatEvent(this.player.getBukkitEntity(), recipients, formatter, message); + } + + @SuppressWarnings("deprecation") diff --git a/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 4aa1a9cba..32e2a8ab3 100644 --- a/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -26,10 +26,10 @@ index db2dddd12f54e6d15916c4cee623676541de37fb..1942f5224aaebb18adb591d6f70a419c + } } diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index d7945e7340f406fbf21a1bd67f9c167a309d0fb7..63085b09eb4d7dc5ebbad9f3d8d6309990473b45 100644 +index a8bc84d476093e6b39564450564f676adccde898..4934b732a602e0c9aba4957459490455b4b368b2 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -13,7 +13,9 @@ import net.kyori.adventure.text.event.ClickEvent; +@@ -14,7 +14,9 @@ import net.kyori.adventure.text.event.ClickEvent; import net.minecraft.server.EntityPlayer; import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.MinecraftServer; @@ -39,7 +39,7 @@ index d7945e7340f406fbf21a1bd67f9c167a309d0fb7..63085b09eb4d7dc5ebbad9f3d8d63099 import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.Waitable; -@@ -99,6 +101,9 @@ public final class ChatProcessor { +@@ -102,6 +104,9 @@ public final class ChatProcessor { } private static Component displayName(final CraftPlayer player) {