summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalodev@gmx.co.uk>2012-06-18 13:55:25 +0100
committerementalo <ementalodev@gmx.co.uk>2012-06-18 13:55:25 +0100
commit89eca7d99158e59e9a6807492bdf219dc25c31a6 (patch)
tree9100782dcfdb97087b3a871320ce03e665250224
parent88e7e684afbc67ad7b6410e5429c2760cd93b542 (diff)
downloadEssentials-89eca7d99158e59e9a6807492bdf219dc25c31a6.tar
Essentials-89eca7d99158e59e9a6807492bdf219dc25c31a6.tar.gz
Essentials-89eca7d99158e59e9a6807492bdf219dc25c31a6.tar.lz
Essentials-89eca7d99158e59e9a6807492bdf219dc25c31a6.tar.xz
Essentials-89eca7d99158e59e9a6807492bdf219dc25c31a6.zip
2.9 Merges
Make /vanish follow the same rules as /fly, /god and /gamemode Add espawn to plugin.yml Allow your hat to be removed with /hat remove void silent command failures on /hat (ie typing /hat fish will no longer silently return as if broken) Fix /exp so it can be used in the console Using /exp, show can't find player message, if no matching player is found Replace op ignore exempt with ignore exempt chat permission: essentials.chat.ignoreexempt This permission won't prevent a player from ignoring the player, but the player will see the chat messages anyway. Fix chat showing [spy] prefix when social spy was not required to see the message Players should not be able to ignore Console Also implement chat exempt permission in other commands. Prevent joinbots from triggering join code, unless they are actually connected to the server and online.
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IUser.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandexp.java118
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhat.java46
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandignore.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmail.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmsg.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpa.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandvanish.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/listener/EssentialsPlayerListener.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/permissions/Permissions.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/user/User.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/user/UserBase.java12
-rw-r--r--Essentials/src/plugin.yml6
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java35
15 files changed, 182 insertions, 99 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index efe9e44e1..ee9926abe 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -440,7 +440,7 @@ public class Essentials extends JavaPlugin implements IEssentials
for (Player player : players)
{
final IUser user = getUser(player);
- if (!user.isIgnoringPlayer(sender.getName()))
+ if (!user.isIgnoringPlayer(sender))
{
player.sendMessage(message);
}
diff --git a/Essentials/src/com/earth2me/essentials/api/IUser.java b/Essentials/src/com/earth2me/essentials/api/IUser.java
index 6fc804d93..fa54ffd21 100644
--- a/Essentials/src/com/earth2me/essentials/api/IUser.java
+++ b/Essentials/src/com/earth2me/essentials/api/IUser.java
@@ -70,9 +70,9 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
boolean isGodModeEnabled();
- boolean isIgnoringPlayer(String name);
+ boolean isIgnoringPlayer(IUser user);
- void setIgnoredPlayer(String name, boolean set);
+ void setIgnoredPlayer(IUser user, boolean set);
Location getAfkPosition();
@@ -124,4 +124,6 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
void setGodModeEnabled(boolean set);
+ void setVanished(boolean set);
+
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
index f5b9c3053..081ef6bc3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
@@ -2,9 +2,10 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser;
-import com.earth2me.essentials.utils.Util;
import com.earth2me.essentials.craftbukkit.SetExpFix;
import com.earth2me.essentials.permissions.Permissions;
+import com.earth2me.essentials.utils.Util;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -13,6 +14,7 @@ public class Commandexp extends EssentialsCommand
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
+
if (args.length == 0)
{
showExp(user, user);
@@ -21,68 +23,106 @@ public class Commandexp extends EssentialsCommand
{
if (args.length == 3 && Permissions.EXP_SET_OTHERS.isAuthorized(user))
{
- boolean foundUser = false;
- for (Player matchPlayer : server.matchPlayer(args[1]))
- {
- IUser target = ess.getUser(matchPlayer);
- setExp(user, target, args[2], false);
- foundUser = true;
- }
- if (foundUser == false)
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
- return;
+ expMatch(user, args[1], args[2], false);
+ }
+ else
+ {
+ setExp(user, user, args[1], false);
}
- setExp(user, user, args[1], false);
}
else if (args[0].equalsIgnoreCase("give") && Permissions.EXP_GIVE.isAuthorized(user))
{
if (args.length == 3 && Permissions.EXP_GIVE_OTHERS.isAuthorized(user))
{
- boolean foundUser = false;
- for (Player matchPlayer : server.matchPlayer(args[1]))
- {
- IUser target = ess.getUser(matchPlayer);
- setExp(user, target, args[2], true);
- foundUser = true;
- }
- if (foundUser == false)
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
- return;
+ expMatch(user, args[1], args[2], true);
+ }
+ else
+ {
+ setExp(user, user, args[1], true);
}
- setExp(user, user, args[1], true);
}
else
{
- String search = args[0].trim();
+ String match = args[0].trim();
if (args.length == 2)
{
- search = args[1].trim();
+ match = args[1].trim();
}
- if (search.equalsIgnoreCase("show") || !Permissions.EXP_OTHERS.isAuthorized(user))
+ if (match.equalsIgnoreCase("show") || !Permissions.EXP_OTHERS.isAuthorized(user))
{
showExp(user, user);
- return;
}
- for (Player matchPlayer : server.matchPlayer(search))
+ else
{
- IUser target = ess.getUser(matchPlayer);
- showExp(user, target);
+ showMatch(user, match);
}
}
}
- private void showExp(final IUser user, final IUser target)
+
+ public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ {
+ if (args.length < 1)
+ {
+ throw new NotEnoughArgumentsException();
+ }
+ else if (args.length > 2 && args[0].equalsIgnoreCase("set"))
+ {
+ expMatch(sender, args[1], args[2], false);
+ }
+ else if (args.length > 2 && args[0].equalsIgnoreCase("give"))
+ {
+ expMatch(sender, args[1], args[2], true);
+ }
+ else
+ {
+ String match = args[0].trim();
+ if (args.length == 2)
+ {
+ match = args[1].trim();
+ }
+ showMatch(sender, match);
+ }
+ }
+
+ private void showMatch(final CommandSender sender, final String match) throws NotEnoughArgumentsException
+ {
+ boolean foundUser = false;
+ for (Player matchPlayer : server.matchPlayer(match))
+ {
+ foundUser = true;
+ final IUser target = ess.getUser(matchPlayer);
+ showExp(sender, target);
+ }
+ if (!foundUser)
+ {
+ throw new NotEnoughArgumentsException(_("playerNotFound"));
+ }
+ }
+
+ private void expMatch(final CommandSender sender, final String match, final String amount, final boolean toggle) throws NotEnoughArgumentsException
+ {
+ boolean foundUser = false;
+ for (Player matchPlayer : server.matchPlayer(match))
+ {
+ final IUser target = ess.getUser(matchPlayer);
+ setExp(sender, target, amount, toggle);
+ foundUser = true;
+ }
+ if (!foundUser)
+ {
+ throw new NotEnoughArgumentsException(_("playerNotFound"));
+ }
+ }
+
+ private void showExp(final CommandSender sender, final IUser target)
{
final int totalExp = SetExpFix.getTotalExperience(target);
final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1));
- user.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
+ sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft));
}
- private void setExp(final IUser user, final IUser target, final String strAmount, final boolean give)
+ private void setExp(final CommandSender sender, final IUser target, final String strAmount, final boolean give)
{
Long amount = Long.parseLong(strAmount);
if (give)
@@ -94,6 +134,6 @@ public class Commandexp extends EssentialsCommand
amount = (long)Integer.MAX_VALUE;
}
SetExpFix.setTotalExperience(target, amount.intValue());
- user.sendMessage(_("expSet", target.getDisplayName(), amount));
+ sender.sendMessage(_("expSet", target.getDisplayName(), amount));
}
-}
+} \ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhat.java b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java
index 7be212373..91108225c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhat.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser;
+import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@@ -12,24 +13,45 @@ public class Commandhat extends EssentialsCommand
@Override
protected void run(IUser user, String commandLabel, String[] args) throws Exception
{
- if (user.getItemInHand().getType() != Material.AIR)
+ if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0")))
{
- final ItemStack hand = user.getItemInHand();
- if (hand.getType().getMaxDurability() == 0)
+ final PlayerInventory inv = user.getInventory();
+ final ItemStack head = inv.getHelmet();
+ if (head == null || head.getType() == Material.AIR)
{
- final PlayerInventory inv = user.getInventory();
- final ItemStack head = inv.getHelmet();
- inv.removeItem(hand);
- inv.setHelmet(hand);
- inv.setItemInHand(head);
- user.sendMessage(_("hatPlaced"));
- } else {
- user.sendMessage(_("hatArmor"));
+ user.sendMessage(_("hatEmpty"));
+ }
+ else
+ {
+ final ItemStack air = new ItemStack(Material.AIR);
+ inv.setHelmet(air);
+ InventoryWorkaround.addItem(user.getInventory(), true, head);
+ user.sendMessage(_("hatRemoved"));
}
}
else
{
- user.sendMessage(_("hatFail"));
+ if (user.getItemInHand().getType() != Material.AIR)
+ {
+ final ItemStack hand = user.getItemInHand();
+ if (hand.getType().getMaxDurability() == 0)
+ {
+ final PlayerInventory inv = user.getInventory();
+ final ItemStack head = inv.getHelmet();
+ inv.removeItem(hand);
+ inv.setHelmet(hand);
+ inv.setItemInHand(head);
+ user.sendMessage(_("hatPlaced"));
+ }
+ else
+ {
+ user.sendMessage(_("hatArmor"));
+ }
+ }
+ else
+ {
+ user.sendMessage(_("hatFail"));
+ }
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
index 9b3ff71cc..9b06cfa64 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
@@ -26,16 +26,16 @@ public class Commandignore extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
- final String name = player.getName();
+
user.acquireWriteLock();
- if (user.isIgnoringPlayer(name))
+ if (user.isIgnoringPlayer(player))
{
- user.setIgnoredPlayer(name, false);
+ user.setIgnoredPlayer(player, false);
user.sendMessage(_("unignorePlayer", player.getName()));
}
else
{
- user.setIgnoredPlayer(name, true);
+ user.setIgnoredPlayer(player, true);
user.sendMessage(_("ignorePlayer", player.getName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
index db39d1c01..1454345da 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
@@ -52,7 +52,7 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(_("playerNeverOnServer", args[1]));
}
- if (!u.isIgnoringPlayer(user.getName()))
+ if (!u.isIgnoringPlayer(user))
{
final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2)));
u.addMail(user.getName() + ": " + mail);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
index c6b42f16c..7da2b9675 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
@@ -86,7 +86,7 @@ public class Commandmsg extends EssentialsCommand
{
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
final IUser matchedUser = ess.getUser(matchedPlayer);
- if (sender instanceof Player && (matchedUser.isIgnoringPlayer(((Player)sender).getName()) || matchedUser.isHidden()))
+ if (sender instanceof Player && (matchedUser.isIgnoringPlayer(ess.getUser(sender)) || matchedUser.isHidden()))
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
index 6e5f7ec53..f6003316d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
@@ -32,7 +32,7 @@ public class Commandtpa extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
}
- if (!player.isIgnoringPlayer(user.getName()))
+ if (!player.isIgnoringPlayer(user))
{
player.requestTeleport(user, false);
player.sendMessage(_("teleportRequest", user.getDisplayName()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
index 5eadcc286..9e8997a7c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
@@ -2,8 +2,6 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser;
-import com.earth2me.essentials.permissions.Permissions;
-import org.bukkit.entity.Player;
public class Commandvanish extends EssentialsCommand
@@ -11,14 +9,29 @@ public class Commandvanish extends EssentialsCommand
@Override
protected void run(IUser user, String commandLabel, String[] args) throws Exception
{
- user.toggleVanished();
- if (user.isVanished())
+ if (args.length < 1)
{
- user.sendMessage(_("unvanished"));
+ user.toggleVanished();
+ if (user.isVanished())
+ {
+ user.sendMessage(_("vanished"));
+ }
+ else
+ {
+ user.sendMessage(_("unvanished"));
+ }
}
else
{
- user.sendMessage(_("unvanished"));
+ if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1"))
+ {
+ user.setVanished(true);
+ }
+ else
+ {
+ user.setVanished(false);
+ }
+ user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished"));
}
- }
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/listener/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/listener/EssentialsPlayerListener.java
index 3702290ae..d6f539f70 100644
--- a/Essentials/src/com/earth2me/essentials/listener/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/listener/EssentialsPlayerListener.java
@@ -74,7 +74,7 @@ public class EssentialsPlayerListener implements Listener
while (it.hasNext())
{
final IUser player = ess.getUser(it.next());
- if (player.isIgnoringPlayer(user.getName()))
+ if (player.isIgnoringPlayer(user))
{
it.remove();
}
@@ -147,6 +147,10 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
+ if (!event.getPlayer().isOnline())
+ {
+ return;
+ }
ess.getBackup().startTask();
@Cleanup
final IUser user = ess.getUser(event.getPlayer());
diff --git a/Essentials/src/com/earth2me/essentials/permissions/Permissions.java b/Essentials/src/com/earth2me/essentials/permissions/Permissions.java
index ddfa78348..05627210b 100644
--- a/Essentials/src/com/earth2me/essentials/permissions/Permissions.java
+++ b/Essentials/src/com/earth2me/essentials/permissions/Permissions.java
@@ -20,6 +20,7 @@ public enum Permissions implements IPermission
BAN_OFFLINE,
BREAK_BEDROCK,
CHAT_COLOR,
+ CHAT_IGNORE_EXEMPT,
CHAT_SPY,
CLEARINVENTORY_OTHERS,
DELHOME_OTHERS,
diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java
index 8207285f7..3e9c6409a 100644
--- a/Essentials/src/com/earth2me/essentials/user/User.java
+++ b/Essentials/src/com/earth2me/essentials/user/User.java
@@ -741,11 +741,11 @@ public class User extends UserBase implements IUser
return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis();
}
- @Override
- public void toggleVanished()
+
+ public void setVanished(boolean set)
{
- vanished = !vanished;
- if (vanished)
+ vanished = set;
+ if (set)
{
for (Player p : ess.getServer().getOnlinePlayers())
{
diff --git a/Essentials/src/com/earth2me/essentials/user/UserBase.java b/Essentials/src/com/earth2me/essentials/user/UserBase.java
index d8f9f264b..436a9c76f 100644
--- a/Essentials/src/com/earth2me/essentials/user/UserBase.java
+++ b/Essentials/src/com/earth2me/essentials/user/UserBase.java
@@ -3,7 +3,9 @@ package com.earth2me.essentials.user;
import com.earth2me.essentials.utils.Util;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.ISettings;
+import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.api.InvalidNameException;
+import com.earth2me.essentials.permissions.Permissions;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import com.earth2me.essentials.storage.Location.WorldNotLoadedException;
import java.io.File;
@@ -328,12 +330,12 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
}
}
- public boolean isIgnoringPlayer(final String name)
+ public boolean isIgnoringPlayer(final IUser user)
{
acquireReadLock();
try
{
- return getData().getIgnore() == null ? false : getData().getIgnore().contains(name.toLowerCase(Locale.ENGLISH));
+ return getData().getIgnore() == null ? false : getData().getIgnore().contains(user.getName().toLowerCase(Locale.ENGLISH)) && Permissions.CHAT_IGNORE_EXEMPT.isAuthorized(user);
}
finally
{
@@ -341,7 +343,7 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
}
}
- public void setIgnoredPlayer(final String name, final boolean set)
+ public void setIgnoredPlayer(final IUser user, final boolean set)
{
acquireWriteLock();
try
@@ -352,11 +354,11 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
}
if (set)
{
- getData().getIgnore().add(name.toLowerCase(Locale.ENGLISH));
+ getData().getIgnore().add(user.getName().toLowerCase(Locale.ENGLISH));
}
else
{
- getData().getIgnore().remove(name.toLowerCase(Locale.ENGLISH));
+ getData().getIgnore().remove(user.getName().toLowerCase(Locale.ENGLISH));
}
}
finally
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 271330f41..f2b897208 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -137,7 +137,7 @@ commands:
aliases: [tgm,godmode,egod,etgm,egodmode]
hat:
description: Get some cool new headgear
- usage: /<command>
+ usage: /<command> [remove]
aliases: [ehat]
heal:
description: Heals you or the given player.
@@ -321,7 +321,7 @@ commands:
spawn:
description: Teleport to the spawnpoint.
usage: /<command> [player]
- aliases: [esetspawn]
+ aliases: [espawn]
spawner:
description: Change the mob type of a spawner
usage: /<command> <mob>
@@ -424,7 +424,7 @@ commands:
aliases: [eunlimited,ul,unl,eul,eunl]
vanish:
description: Hide yourself from other players.
- usage: /<command>
+ usage: /<command> [on|off]
aliases: [evanish]
warp:
description: List all warps or warp to the specified location.
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java
index 8788d755d..04c49b698 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java
@@ -37,36 +37,35 @@ public class EssentialsLocalChatEventListener implements Listener
{
String type = _("chatTypeLocal");
final IUser user = ess.getUser(onlinePlayer);
- //TODO: remove reference to op
- if (user.isIgnoringPlayer(sender.getName()) && !sender.isOp())
+ if (user.isIgnoringPlayer(ess.getUser(sender)))
{
continue;
}
if (!user.equals(sender))
{
- if (Permissions.CHAT_SPY.isAuthorized(user))
+ boolean abort = false;
+ final Location playerLoc = user.getLocation();
+ if (playerLoc.getWorld() != world)
{
- type = type.concat(_("chatTypeSpy"));
+ abort = true;
}
- else
+ final double delta = playerLoc.distanceSquared(loc);
+
+ if (delta > event.getRadius())
{
- final Location playerLoc = user.getLocation();
- if (playerLoc.getWorld() != world)
- {
- continue;
- }
- final double delta = playerLoc.distanceSquared(loc);
+ abort = true;
+ }
- if (delta > event.getRadius())
+ if (abort)
+ {
+ if (ChatPermissions.getPermission("spy").isAuthorized(user))
{
- continue;
+ type = type.concat(_("chatTypeSpy"));
}
}
-
- final String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage()));
- user.sendMessage(message);
}
+ final String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage()));
+ user.sendMessage(message);
}
-
}
-} \ No newline at end of file
+}