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
1 changed files with 12 additions and 9 deletions

View File

@ -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());