diff options
author | Prof-Bloodstone <[email protected]> | 2021-04-22 20:28:22 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-22 20:28:22 +0200 |
commit | d94882043d21d3e4f00f0172bfe1657f18c73d13 (patch) | |
tree | 748e948d24606cd0486d07aa50d7e13fd63bbb35 | |
parent | 053bd82cc2edc39c3dedc7ee11769ea6299a9aba (diff) | |
download | Paper-d94882043d21d3e4f00f0172bfe1657f18c73d13.tar.gz Paper-d94882043d21d3e4f00f0172bfe1657f18c73d13.zip |
Fix legacyComposer not using AsyncChatEvent messages (#5509)
-rw-r--r-- | Spigot-Server-Patches/0010-Adventure.patch | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Spigot-Server-Patches/0010-Adventure.patch b/Spigot-Server-Patches/0010-Adventure.patch index e30d58d128..8500dd6601 100644 --- a/Spigot-Server-Patches/0010-Adventure.patch +++ b/Spigot-Server-Patches/0010-Adventure.patch @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..89597b4a3064c3c6001c7e927a848ee7 +} 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..84dcca67ccd2e52881b4a97de0f061b396ab5f35 +index 0000000000000000000000000000000000000000..50253e8dfffc84e26f02c6a470a5a8b078d90e12 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java @@ -0,0 +1,215 @@ @@ -165,13 +165,13 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3 + this.async = async; + } + -+ @SuppressWarnings("CodeBlock2Expr") ++ @SuppressWarnings({"CodeBlock2Expr", "deprecated"}) + public void process() { + this.processingLegacyFirst( + // continuing from AsyncPlayerChatEvent (without PlayerChatEvent) + event -> { + this.processModern( -+ legacyComposer(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()), ++ legacyComposer(event.getFormat()), + event.getRecipients(), + PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()), + event.isCancelled() @@ -180,7 +180,7 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3 + // continuing from AsyncPlayerChatEvent and PlayerChatEvent + event -> { + this.processModern( -+ legacyComposer(event.getFormat(), legacyDisplayName((CraftPlayer) event.getPlayer()), event.getMessage()), ++ legacyComposer(event.getFormat()), + event.getRecipients(), + PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getMessage()), + event.isCancelled() @@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..84dcca67ccd2e52881b4a97de0f061b3 + return player.displayName(); + } + -+ private static ChatComposer legacyComposer(final String format, final String legacyDisplayName, final String legacyMessage) { -+ return (player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName, legacyMessage)).replaceText(URL_REPLACEMENT_CONFIG); ++ private static ChatComposer legacyComposer(final String format) { ++ return (player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName((CraftPlayer) player), PaperAdventure.LEGACY_SECTION_UXRC.serialize(message))).replaceText(URL_REPLACEMENT_CONFIG); + } + + private void queueIfAsyncOrRunImmediately(final Waitable<Void> waitable) { |