summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-07-21 02:42:54 +0200
committersnowleo <schneeleo@gmail.com>2011-07-21 02:42:54 +0200
commit2067bb8f0d692f7add2ce9b0f775374c0d83bd8c (patch)
treef00397badc1f46f6d2130a5896e8c450bea50aca
parent4f31d2779db23090fbc005c7282bc1fb061d2686 (diff)
downloadEssentials-2067bb8f0d692f7add2ce9b0f775374c0d83bd8c.tar
Essentials-2067bb8f0d692f7add2ce9b0f775374c0d83bd8c.tar.gz
Essentials-2067bb8f0d692f7add2ce9b0f775374c0d83bd8c.tar.lz
Essentials-2067bb8f0d692f7add2ce9b0f775374c0d83bd8c.tar.xz
Essentials-2067bb8f0d692f7add2ce9b0f775374c0d83bd8c.zip
EssentialsChat: The user should see his own message
Corrected radius
-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;