1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-05 14:18:21 +02:00

Fix chat showing [spy] prefix when social spy was not required to see the message.

Fixes #2263
This commit is contained in:
KHobbits
2012-06-16 16:05:48 +01:00
parent 5da886593b
commit a764f8c929

View File

@@ -127,23 +127,26 @@ public abstract class EssentialsChatPlayer implements Listener
} }
if (!onlineUser.equals(sender)) if (!onlineUser.equals(sender))
{ {
if (onlineUser.isAuthorized("essentials.chat.spy")) boolean abort = false;
{
type = type.concat(_("chatTypeSpy"));
}
else
{
final Location playerLoc = onlineUser.getLocation(); final Location playerLoc = onlineUser.getLocation();
if (playerLoc.getWorld() != world) if (playerLoc.getWorld() != world)
{ {
continue; abort = true;
} }
final double delta = playerLoc.distanceSquared(loc); final double delta = playerLoc.distanceSquared(loc);
if (delta > chatStore.getRadius()) 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()); String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage());