From a764f8c929a8bf58c5a8d0fac6659b5ddbc554af Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 16 Jun 2012 16:05:48 +0100 Subject: Fix chat showing [spy] prefix when social spy was not required to see the message. Fixes #2263 --- .../essentials/chat/EssentialsChatPlayer.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'EssentialsChat/src/com') diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index c67cb6a64..c65eb5a0e 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -127,23 +127,26 @@ public abstract class EssentialsChatPlayer implements Listener } if (!onlineUser.equals(sender)) { - if (onlineUser.isAuthorized("essentials.chat.spy")) - { - type = type.concat(_("chatTypeSpy")); - } - else - { + boolean abort = false; final Location playerLoc = onlineUser.getLocation(); if (playerLoc.getWorld() != world) { - continue; + abort = true; } final double delta = playerLoc.distanceSquared(loc); if (delta > chatStore.getRadius()) { - continue; + abort = true; } - } + if (abort) { + if (onlineUser.isAuthorized("essentials.chat.spy")) + { + type = type.concat(_("chatTypeSpy")); + } + else + { + continue; + } } String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage()); -- cgit v1.2.3