summaryrefslogtreecommitdiffstats
path: root/EssentialsChat
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
commita9b0537b92c253f7c26f71ae443e3cf6787a28f0 (patch)
tree3670dc9d490f7178c3cbcba968324c43148c4d86 /EssentialsChat
parentc73d73e9f7c17c119bb550529e09d9beb4763b05 (diff)
downloadEssentials-a9b0537b92c253f7c26f71ae443e3cf6787a28f0.tar
Essentials-a9b0537b92c253f7c26f71ae443e3cf6787a28f0.tar.gz
Essentials-a9b0537b92c253f7c26f71ae443e3cf6787a28f0.tar.lz
Essentials-a9b0537b92c253f7c26f71ae443e3cf6787a28f0.tar.xz
Essentials-a9b0537b92c253f7c26f71ae443e3cf6787a28f0.zip
EssentialsChat: The user should see his own message
Corrected radius
Diffstat (limited to 'EssentialsChat')
-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;