summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandburn.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandexp.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgive.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnear.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnuke.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrealname.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandseen.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpa.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java9
18 files changed, 49 insertions, 60 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
index d75722f8d..49cffd37a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java
@@ -27,7 +27,7 @@ public class Commandburn extends EssentialsCommand
throw new NotEnoughArgumentsException("You need to specify a player to burn.");
}
- User user = getPlayer(server, args, 0);
+ User user = getPlayer(server, sender, args, 0);
user.setFireTicks(Integer.parseInt(args[1]) * 20);
sender.sendMessage(_("burnMsg", user.getDisplayName(), Integer.parseInt(args[1])));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
index 89ea456e7..d309b595b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java
@@ -138,12 +138,13 @@ public class Commandexp extends EssentialsCommand
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) 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/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
index d7c6feaa9..098499a9e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
@@ -42,7 +42,7 @@ public class Commandgive extends EssentialsCommand
throw new Exception(_("cantSpawnItem", itemname));
}
- final User giveTo = getPlayer(server, args, 0);
+ final User giveTo = getPlayer(server, sender, args, 0);
try
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
index 294939f8f..f999e68a3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
@@ -87,11 +87,12 @@ public class Commandnear extends EssentialsCommand
final World world = loc.getWorld();
final StringBuilder output = new StringBuilder();
final long radiusSquared = radius * radius;
+ boolean showHidden = user.isAuthorized("essentials.vanish.interact");
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
- if (!player.equals(user) && !player.isHidden())
+ if (!player.equals(user) && (!player.isHidden() || showHidden))
{
final Location playerLoc = player.getLocation();
if (playerLoc.getWorld() != world)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
index 60b1e3111..a48bbc4aa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
@@ -29,7 +29,7 @@ public class Commandnuke extends EssentialsCommand
int pos = 0;
for (String arg : args)
{
- targets.add(getPlayer(server, args, pos));
+ targets.add(getPlayer(server, sender, args, pos));
pos++;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
index dac1c6eab..dae764160 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
@@ -24,11 +24,12 @@ public class Commandrealname extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String whois = args[0].toLowerCase(Locale.ENGLISH);
+ boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
boolean foundUser = false;
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User u = ess.getUser(onlinePlayer);
- if (u.isHidden())
+ if (skipHidden && u.isHidden())
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
index b6640a0ca..8efda958f 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
@@ -39,7 +39,7 @@ public class Commandseen extends EssentialsCommand
}
try
{
- User user = getPlayer(server, args, 0);
+ User user = getPlayer(server, sender, args, 0);
seenOnline(server, sender, user, showBan, extra);
}
catch (NoSuchFieldException e)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index efaf32f65..e9bdaa72a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -26,7 +26,7 @@ public class Commandtp extends EssentialsCommand
throw new NotEnoughArgumentsException();
case 1:
- final User player = getPlayer(server, args, 0);
+ final User player = getPlayer(server, user, args, 0);
if (!player.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
@@ -46,7 +46,7 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.tp.others"));
}
- final User target2 = getPlayer(server, args, 0);
+ final User target2 = getPlayer(server, user, args, 0);
final double x = args[1].startsWith("~") ? target2.getLocation().getX() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
final double y = args[2].startsWith("~") ? target2.getLocation().getY() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
final double z = args[3].startsWith("~") ? target2.getLocation().getZ() + Integer.parseInt(args[3].substring(1)) : Integer.parseInt(args[3]);
@@ -69,8 +69,8 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.tp.others"));
}
- final User target = getPlayer(server, args, 0);
- final User toPlayer = getPlayer(server, args, 1);
+ final User target = getPlayer(server, user, args, 0);
+ final User toPlayer = getPlayer(server, user, args, 1);
if (!target.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", target.getDisplayName()));
@@ -99,10 +99,10 @@ public class Commandtp extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User target = getPlayer(server, args, 0);
+ final User target = getPlayer(server, args, 0, true, false);
if (args.length == 2)
{
- final User toPlayer = getPlayer(server, args, 1);
+ final User toPlayer = getPlayer(server, args, 1, true, false);
target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
index 660389694..4b524890a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
@@ -20,7 +20,7 @@ public class Commandtpa extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- User player = getPlayer(server, args, 0);
+ User player = getPlayer(server, user, args, 0);
if (!player.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
index 8f77441ec..41d503318 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
@@ -27,17 +27,17 @@ public class Commandtpaall extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User player = getPlayer(server, args, 0);
- teleportAAllPlayers(server, sender, player);
+ final User target = getPlayer(server, sender, args, 0);
+ teleportAAllPlayers(server, sender, target);
}
- private void teleportAAllPlayers(final Server server, final CommandSender sender, final User user)
+ private void teleportAAllPlayers(final Server server, final CommandSender sender, final User target)
{
sender.sendMessage(_("teleportAAll"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
- if (user == player)
+ if (target == player)
{
continue;
}
@@ -45,15 +45,16 @@ public class Commandtpaall extends EssentialsCommand
{
continue;
}
- if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
- && !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
+ if (target.equals(sender)
+ && target.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !target.isAuthorized("essentials.worlds." + target.getWorld().getName()))
{
continue;
}
try
{
- player.requestTeleport(user, true);
- player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
+ player.requestTeleport(target, true);
+ player.sendMessage(_("teleportHereRequest", target.getDisplayName()));
player.sendMessage(_("typeTpaccept"));
if (ess.getSettings().getTpaAcceptCancellation() != 0)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
index e130949ad..9867fada3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java
@@ -20,7 +20,7 @@ public class Commandtpahere extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User player = getPlayer(server, args, 0);
+ final User player = getPlayer(server, user, args, 0);
if (!player.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
index e94e91d42..73f8f26f1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
@@ -28,28 +28,29 @@ public class Commandtpall extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User player = getPlayer(server, args, 0);
- teleportAllPlayers(server, sender, player);
+ final User target = getPlayer(server, sender, args, 0);
+ teleportAllPlayers(server, sender, target);
}
- private void teleportAllPlayers(Server server, CommandSender sender, User user)
+ private void teleportAllPlayers(Server server, CommandSender sender, User target)
{
sender.sendMessage(_("teleportAll"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
- if (user == player)
+ if (target == player)
{
continue;
}
- if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
- && !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
+ if (target.equals(sender)
+ && target.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !target.isAuthorized("essentials.worlds." + target.getWorld().getName()))
{
continue;
}
try
{
- player.getTeleport().now(user, false, TeleportCause.COMMAND);
+ player.getTeleport().now(target, false, TeleportCause.COMMAND);
}
catch (Exception ex)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
index 76041ca6c..c0372283b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
@@ -17,7 +17,7 @@ public class Commandtphere extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- final User player = getPlayer(server, args, 0);
+ final User player = getPlayer(server, user, args, 0);
if (!player.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index 50c239c38..729007151 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -22,11 +22,7 @@ public class Commandtpo extends EssentialsCommand
throw new NotEnoughArgumentsException();
case 1:
- final User player = getPlayer(server, args, 0, true, false);
- if (player.isHidden() && !user.isAuthorized("essentials.teleport.hidden"))
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
+ final User player = getPlayer(server, user, args, 0);
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + player.getWorld().getName()))
{
@@ -42,13 +38,8 @@ public class Commandtpo extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.tp.others"));
}
user.sendMessage(_("teleporting"));
- final User target = getPlayer(server, args, 0, true, false);
- final User toPlayer = getPlayer(server, args, 1, true, false);
-
- if ((target.isHidden() || toPlayer.isHidden()) && !user.isAuthorized("essentials.teleport.hidden"))
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
+ final User target = getPlayer(server, user, args, 0);
+ final User toPlayer = getPlayer(server, user, args, 1);
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + toPlayer.getWorld().getName()))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
index 50f4d74fe..eb9c3538c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
@@ -22,7 +22,7 @@ public class Commandtpohere extends EssentialsCommand
}
//Just basically the old tphere command
- final User player = getPlayer(server, args, 0, true, false);
+ final User player = getPlayer(server, user, args, 0);
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
@@ -31,14 +31,8 @@ public class Commandtpohere extends EssentialsCommand
}
// Verify permission
- if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
- {
- player.getTeleport().now(user, false, TeleportCause.COMMAND);
- user.sendMessage(_("teleporting"));
- }
- else
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
+ player.getTeleport().now(user, false, TeleportCause.COMMAND);
+ user.sendMessage(_("teleporting"));
+
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
index 302d357e4..00e65aab7 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
@@ -44,7 +44,7 @@ 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 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)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index 509b2cd08..4ab9b3596 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -42,7 +42,7 @@ public class Commandwarp extends EssentialsCommand
User otherUser = null;
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others")))
{
- otherUser = getPlayer(server, args, 1, user.isAuthorized("essentials.teleport.hidden"), false);
+ otherUser = getPlayer(server, user, args, 1);
warpUser(user, otherUser, args[0]);
throw new NoChargeException();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
index 6d2f775ed..ab84fb9d9 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
@@ -43,15 +43,14 @@ public abstract class EssentialsCommand implements IEssentialsCommand
return name;
}
- @Deprecated
- protected User getPlayer(final Server server, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
+ protected User getPlayer(final Server server, final User user, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
{
- return getPlayer(server, null, args, pos, false, false);
+ return getPlayer(server, user, args, pos, user.isAuthorized("essentials.vanish.interact"), false);
}
- protected User getPlayer(final Server server, final User user, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
+ protected User getPlayer(final Server server, final CommandSender sender, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
{
- return getPlayer(server, user, args, pos, user.isAuthorized("essentials.vanish.interact"), false);
+ return getPlayer(server, null, args, pos, true, false);
}
protected User getPlayer(final Server server, final String[] args, final int pos, boolean getHidden, final boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException