EssentialsChat: The user should see his own message

Corrected radius
This commit is contained in:
snowleo 2011-07-21 02:42:54 +02:00
parent 4f31d2779d
commit 2067bb8f0d
1 changed files with 7 additions and 6 deletions

View File

@ -52,11 +52,12 @@ public class EssentialsChatPlayerListener extends PlayerListener
event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '§').replace("§§", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase()));
final int radius = ess.getSettings().getChatRadius();
long radius = ess.getSettings().getChatRadius();
if (radius < 1)
{
return;
}
radius *= radius;
if (event.getMessage().startsWith("!") && event.getMessage().length() > 1)
{
@ -100,13 +101,13 @@ public class EssentialsChatPlayerListener extends PlayerListener
{
continue;
}
if (!u.equals(user) && !u.isAuthorized("essentials.chat.spy"))
if (!u.isAuthorized("essentials.chat.spy"))
{
final Location l = u.getLocation();
final int dx = Math.abs(x - l.getBlockX());
final int dy = Math.abs(y - l.getBlockY());
final int dz = Math.abs(z - l.getBlockZ());
final int delta = dx + dy + dz;
final int dx = x - l.getBlockX();
final int dy = y - l.getBlockY();
final int dz = z - l.getBlockZ();
final long delta = dx*dx + dy*dy + dz*dz;
if (delta > radius || world != l.getWorld())
{
continue;