From ac9bddc0c61e2c88b7ed5481fd78b39e5c29e32f Mon Sep 17 00:00:00 2001 From: rain <76555708+rainnvfx@users.noreply.github.com> Date: Sat, 10 Jan 2026 02:14:08 +0400 Subject: [PATCH] Fixed duplicate messages when messaging spyUser Now when an admin is the sender or the msg target, the spy message doesn't show up. It used to show the normal msg and then the spy msg after that, creating duplicate messages. --- .../java/net/voxelarc/allaychat/chat/LocalChatManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/voxelarc/allaychat/chat/LocalChatManager.java b/src/main/java/net/voxelarc/allaychat/chat/LocalChatManager.java index 955dcd7..fbd62fb 100644 --- a/src/main/java/net/voxelarc/allaychat/chat/LocalChatManager.java +++ b/src/main/java/net/voxelarc/allaychat/chat/LocalChatManager.java @@ -318,7 +318,11 @@ && handleMessage(from, message)) { this.lastMessageCache.put(from.getName(), to); this.lastMessageCache.put(to, from.getName()); - plugin.getUserManager().getAllUsers().stream().filter(ChatUser::isSpyEnabled).forEach(spyUser -> { + plugin.getUserManager().getAllUsers().stream() + .filter(ChatUser::isSpyEnabled) + .filter(spyUser -> !spyUser.getUniqueId().equals(from.getUniqueId()) + && !spyUser.getUniqueId().equals(target.getUniqueId())) + .forEach(spyUser -> { Player player = Bukkit.getPlayer(spyUser.getUniqueId()); if (player == null) return;