summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-06-16 16:05:48 +0100
committerKHobbits <rob@khobbits.co.uk>2012-06-16 16:05:48 +0100
commit0e29e2ac6034715613f719fda591a51c4f6c51ba (patch)
treebf3efaafb8474f88c87fd4af649f34104faefc97 /EssentialsChat/src
parent3f7d252c319760c14c127cd8397fbacdcf22b6a3 (diff)
downloadEssentials-0e29e2ac6034715613f719fda591a51c4f6c51ba.tar
Essentials-0e29e2ac6034715613f719fda591a51c4f6c51ba.tar.gz
Essentials-0e29e2ac6034715613f719fda591a51c4f6c51ba.tar.lz
Essentials-0e29e2ac6034715613f719fda591a51c4f6c51ba.tar.xz
Essentials-0e29e2ac6034715613f719fda591a51c4f6c51ba.zip
Fix chat showing [spy] prefix when social spy was not required to see the message.
Fixes #2263
Diffstat (limited to 'EssentialsChat/src')
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java21
1 files changed, 12 insertions, 9 deletions
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());