diff options
12 files changed, 40 insertions, 29 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 089d64536..89ea456e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -117,12 +117,13 @@ public class Commandexp extends EssentialsCommand private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
{
+ boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
boolean foundUser = false;
final List<Player> matchedPlayers = server.matchPlayer(match);
for (Player matchPlayer : matchedPlayers)
{
final User player = ess.getUser(matchPlayer);
- if (player.isHidden())
+ if (skipHidden && player.isHidden())
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 28313a814..552f74db2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -41,12 +41,13 @@ public class Commandext extends EssentialsCommand private void extinguishPlayers(final Server server, final CommandSender sender, final String name) throws Exception { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index 0d8a43776..4644e6c3a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -32,12 +32,13 @@ public class Commandfeed extends EssentialsCommand private void feedOtherPlayers(final Server server, final CommandSender sender, final String name) throws NotEnoughArgumentsException { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java index b3f7283d5..1d5353fb1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -63,12 +63,13 @@ public class Commandfly extends EssentialsCommand private void flyOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws NotEnoughArgumentsException { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 5dbe09da7..9707c8403 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -85,12 +85,13 @@ public class Commandgamemode extends EssentialsCommand throw new NotEnoughArgumentsException("You need to specify a valid player/mode."); } + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index a8dd4b077..a77648c86 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -50,12 +50,13 @@ public class Commandgod extends EssentialsCommand private void godOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws NotEnoughArgumentsException { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index a68b2eac9..e1495bdc6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -50,13 +50,13 @@ public class Commandheal extends EssentialsCommand private void healOtherPlayers(final Server server, final CommandSender sender, final String name) throws Exception { - + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 792ed4906..9d990fd05 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -29,7 +29,7 @@ public class Commandkick extends EssentialsCommand if (sender instanceof Player) { User user = ess.getUser(sender); - if (target.isHidden() && !user.isAuthorized("essentials.list.hidden")) + if (target.isHidden() && !user.isAuthorized("essentials.vanish.interact")) { throw new PlayerNotFoundException(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index d458cd951..585bb5b29 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -17,7 +17,7 @@ public class Commandmsg extends EssentialsCommand { super("msg"); } - + @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { @@ -25,7 +25,7 @@ public class Commandmsg extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - + String message = getFinalArg(args, 1); if (sender instanceof Player) { @@ -40,12 +40,12 @@ public class Commandmsg extends EssentialsCommand { message = Util.replaceFormat(message); } - + final String translatedMe = _("me"); - + final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo(); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - + if (args[0].equalsIgnoreCase(Console.NAME)) { sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message)); @@ -55,36 +55,38 @@ public class Commandmsg extends EssentialsCommand Console.getConsoleReplyTo().setReplyTo(sender); return; } - + + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; - final List<Player> matchedPlayers = server.matchPlayer(args[0]); - + final List<Player> matchedPlayers = server.matchPlayer(args[0]); + for (Player matchPlayer : matchedPlayers) - { + { final User matchedUser = ess.getUser(matchPlayer); - - if (sender instanceof Player && matchedUser.isHidden()) + + if (skipHidden && matchedUser.isHidden()) { continue; - } + } foundUser = true; if (matchedUser.isAfk()) { sender.sendMessage(_("userAFK", matchPlayer.getDisplayName())); - } + } - sender.sendMessage(_("msgFormat", translatedMe, matchPlayer.getDisplayName(), message)); + sender.sendMessage(_("msgFormat", translatedMe, matchPlayer.getDisplayName(), message)); if (sender instanceof Player && matchedUser.isIgnoredPlayer(ess.getUser(sender))) { continue; } - + matchPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message)); replyTo.setReplyTo(matchedUser); ess.getUser(matchPlayer).setReplyTo(sender); } - - if (!foundUser) { + + if (!foundUser) + { throw new Exception(_("playerNotFound")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index 8af20e888..60b9baa66 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -31,12 +31,13 @@ public class Commandpay extends EssentialsCommand double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); + boolean skipHidden = !user.isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) { User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index 97719fc08..591ea638e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -68,12 +68,13 @@ public class Commandspeed extends EssentialsCommand private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws NotEnoughArgumentsException { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(name); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java index c1ff68146..948ead391 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java @@ -40,12 +40,13 @@ public class Commandtptoggle extends EssentialsCommand private void toggleOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws NotEnoughArgumentsException { + boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.teleport.hidden"); boolean foundUser = false; final List<Player> matchedPlayers = server.matchPlayer(args[0]); for (Player matchPlayer : matchedPlayers) { final User player = ess.getUser(matchPlayer); - if (player.isHidden()) + if (skipHidden && player.isHidden()) { continue; } |