From 62048076ef0478d05aee325bce6316119d49fb52 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 9 Feb 2023 18:15:21 +0100 Subject: [PATCH] Send disguised chat for vanished players --- patches/server/Adventure.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index b1e190efbc..8e6a3c5824 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2269,6 +2269,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Player player = this.getCraftPlayer(); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); String originalFormat = event.getFormat(), originalMessage = event.getMessage(); +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + + public void sendPlayerChatMessage(PlayerChatMessage message, ChatType.Bound params) { ++ // Paper start ++ if (!this.getCraftPlayer().canSee(message.link().sender())) { ++ this.sendDisguisedChatMessage(message.decoratedContent(), params); ++ return; ++ } ++ // Paper end + this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params.toNetwork(this.player.level.registryAccess()))); + this.addPendingMessage(message); + } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return; } @@ -3459,6 +3472,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return !this.hiddenEntities.containsKey(entity.getUniqueId()); + } + ++ // Paper start ++ public boolean canSee(UUID entityUUID) { ++ return !this.hiddenEntities.containsKey(entityUUID); ++ } ++ // Paper end ++ + @Override + public Map serialize() { + Map result = new LinkedHashMap(); +@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url) {