mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix legacyComposer not using AsyncChatEvent messages (#5509)
This commit is contained in:
parent
23b028a34f
commit
27c8f8cf70
1 changed files with 5 additions and 5 deletions
|
@ -165,13 +165,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ 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..00000000000000000000000000000000
|
|||
+ // 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..00000000000000000000000000000000
|
|||
+ 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) {
|
||||
|
|
Loading…
Reference in a new issue