From e4e3475ac3c06357afd03f72da069ea67a470cd7 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Wed, 21 Apr 2021 18:31:45 -0700 Subject: [PATCH] fix #5526 - use correct type when sending message to clients --- Spigot-Server-Patches/Adventure.patch | 11 ++++++++++- ...o-use-vanilla-per-world-scoreboard-coloring-.patch | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Adventure.patch b/Spigot-Server-Patches/Adventure.patch index 682ee07a5b..ac099dcfb0 100644 --- a/Spigot-Server-Patches/Adventure.patch +++ b/Spigot-Server-Patches/Adventure.patch @@ -124,6 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextReplacementConfig; +import net.kyori.adventure.text.event.ClickEvent; ++import net.minecraft.network.chat.ChatMessageType; +import net.minecraft.network.chat.IChatBaseComponent; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.EntityPlayer; @@ -271,7 +272,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (((LazyPlayerSet) event.recipients()).isLazy()) { + final IChatBaseComponent vanilla = PaperAdventure.asVanilla(message); + for (final EntityPlayer recipient : this.server.getPlayerList().players) { -+ recipient.sendMessage(vanilla, this.player.getUniqueID()); ++ recipient.sendMessage(vanilla, ChatMessageType.CHAT, this.player.getUniqueID()); + } + } else { + for (final Player recipient : event.recipients()) { @@ -1187,6 +1188,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> { if (!future.isSuccess()) { +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.a(ichatbasecomponent, ChatMessageType.SYSTEM, uuid); + } + ++ public void sendMessage(final IChatBaseComponent message, final ChatMessageType type, final UUID sender) { this.a(message, type, sender); } // Paper - OBFHELPER + public void a(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { + this.playerConnection.a((Packet) (new PacketPlayOutChat(ichatbasecomponent, chatmessagetype, uuid)), (future) -> { + if (!future.isSuccess() && (chatmessagetype == ChatMessageType.GAME_INFO || chatmessagetype == ChatMessageType.SYSTEM)) { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index f32e2e0813..1f1dfcd5e3 100644 --- a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -29,7 +29,7 @@ diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -0,0 +0,0 @@ import net.kyori.adventure.text.event.ClickEvent; +@@ -0,0 +0,0 @@ import net.minecraft.network.chat.ChatMessageType; import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.EntityPlayer;