summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-07-21 02:52:25 +0200
committersnowleo <schneeleo@gmail.com>2011-07-21 02:52:25 +0200
commit6ccb60813a165d2beb5df5e5080ac6041dd41b29 (patch)
treedfa66d5ffd0d2a7ebbc3ec03a7b83fc2ee40558b
parentb34119901ed89a0e3026df2aea0eca24bc0addd2 (diff)
parent2067bb8f0d692f7add2ce9b0f775374c0d83bd8c (diff)
downloadEssentials-6ccb60813a165d2beb5df5e5080ac6041dd41b29.tar
Essentials-6ccb60813a165d2beb5df5e5080ac6041dd41b29.tar.gz
Essentials-6ccb60813a165d2beb5df5e5080ac6041dd41b29.tar.lz
Essentials-6ccb60813a165d2beb5df5e5080ac6041dd41b29.tar.xz
Essentials-6ccb60813a165d2beb5df5e5080ac6041dd41b29.zip
Merge branch 'master' into release
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java
index c4874d631..bb5443a26 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java
@@ -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;