summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-03-20 01:04:35 +0000
committerKHobbits <rob@khobbits.co.uk>2013-03-20 01:29:54 +0000
commitf94b8581c86941d262f30228932f9cd2e2ff58a3 (patch)
tree6f291db0f5e8a7d490562a498ad953a9f1ecbf5e
parent4a506d97df9aaecae35e6018abc0e89fa23c5e6f (diff)
downloadEssentials-f94b8581c86941d262f30228932f9cd2e2ff58a3.tar
Essentials-f94b8581c86941d262f30228932f9cd2e2ff58a3.tar.gz
Essentials-f94b8581c86941d262f30228932f9cd2e2ff58a3.tar.lz
Essentials-f94b8581c86941d262f30228932f9cd2e2ff58a3.tar.xz
Essentials-f94b8581c86941d262f30228932f9cd2e2ff58a3.zip
Use correct getPlayer method to not match offline users.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandafk.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbalance.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandeco.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandessentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandignore.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkick.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkit.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmute.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnear.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnick.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsudo.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunban.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java19
28 files changed, 52 insertions, 50 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
index 7e1d6b0e6..1c9e5ea16 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
@@ -17,7 +17,7 @@ public class Commandafk extends EssentialsCommand
{
if (args.length > 0 && user.isAuthorized("essentials.afk.others"))
{
- User afkUser = getPlayer(server, args, 0);
+ User afkUser = getPlayer(server, user, args, 0);
toggleAfk(afkUser);
}
else
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
index e4aebd197..fde83a561 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java
@@ -21,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
+ sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true, true).getMoney(), ess)));
}
@Override
@@ -32,7 +32,7 @@ public class Commandbalance extends EssentialsCommand
|| !(user.isAuthorized("essentials.balance.others")
|| user.isAuthorized("essentials.balance.other"))
? user
- : getPlayer(server, args, 0, true)).getMoney();
+ : getPlayer(server, args, 0, true, true)).getMoney();
user.sendMessage(_("balance", Util.displayCurrency(bal, ess)));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 5c223a3d5..707ff3e9b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -29,7 +29,7 @@ public class Commandban extends EssentialsCommand
User user;
try
{
- user = getPlayer(server, args, 0, true);
+ user = getPlayer(server, args, 0, true, true);
}
catch (NoSuchFieldException e)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
index 40bbba02d..182b69565 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java
@@ -39,7 +39,7 @@ public class Commanddelhome extends EssentialsCommand
if (expandedArg.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others")))
{
- user = getPlayer(server, expandedArg, 0, true);
+ user = getPlayer(server, expandedArg, 0, true, true);
name = expandedArg[1];
}
else if (user == null)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
index 22ee01a34..20ec02644 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java
@@ -118,7 +118,7 @@ public class Commandeco extends EssentialsCommand
}
else
{
- final User player = getPlayer(server, args, 1, true);
+ final User player = getPlayer(server, args, 1, true, true);
switch (cmd)
{
case GIVE:
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java
index bd707d392..d256e9786 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java
@@ -16,7 +16,7 @@ public class Commandenderchest extends EssentialsCommand
{
if (args.length > 0 && user.isAuthorized("essentials.enderchest.others"))
{
- final User invUser = getPlayer(server, args, 0);
+ final User invUser = getPlayer(server, user, args, 0);
user.openInventory(invUser.getEnderChest());
user.setEnderSee(true);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
index e842fb7a9..5bb7e6ac0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
@@ -90,7 +90,7 @@ public class Commandessentials extends EssentialsCommand
{
throw new Exception("/<command> reset <player>");
}
- final User user = getPlayer(server, args, 1, true);
+ final User user = getPlayer(server, args, 1, true, true);
user.reset();
sender.sendMessage("Reset Essentials userdata for player: " + user.getDisplayName());
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
index c5d32f512..6e6dfcee7 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
@@ -19,7 +19,7 @@ public class Commandgetpos extends EssentialsCommand
{
if (args.length > 0 && user.isAuthorized("essentials.getpos.others"))
{
- final User otherUser = getPlayer(server, args, 0);
+ final User otherUser = getPlayer(server, args, 0, true, false);
if (!otherUser.isHidden() || user.isAuthorized("essentials.list.hidden"))
{
outputPosition(user, otherUser.getLocation(), user.getLocation());
@@ -37,7 +37,7 @@ public class Commandgetpos extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- final User user = getPlayer(server, args, 0);
+ final User user = getPlayer(server, args, 0, true, false);
outputPosition(sender, user.getLocation(), null);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index c1c024b9d..a13616dc0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -34,7 +34,7 @@ public class Commandhome extends EssentialsCommand
}
else
{
- player = getPlayer(server, nameParts, 0, true);
+ player = getPlayer(server, nameParts, 0, true, true);
if (nameParts.length > 1)
{
homeName = nameParts[1];
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
index 8f160e9ba..090903c96 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
@@ -22,7 +22,7 @@ public class Commandignore extends EssentialsCommand
User player;
try
{
- player = getPlayer(server, args, 0);
+ player = getPlayer(server, args, 0, true, true);
}
catch (NoSuchFieldException ex)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
index 1f9083351..1528dc353 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
@@ -22,7 +22,7 @@ public class Commandinvsee extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User invUser = getPlayer(server, args, 0);
+ final User invUser = getPlayer(server, user, args, 0);
Inventory inv;
if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
index 9d990fd05..18884964b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
@@ -25,7 +25,7 @@ public class Commandkick extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User target = getPlayer(server, args, 0);
+ final User target = getPlayer(server, args, 0, true, false);
if (sender instanceof Player)
{
User user = ess.getUser(sender);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
index aa5cf7302..1c9bec8d3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java
@@ -30,7 +30,7 @@ public class Commandkit extends EssentialsCommand
}
else if (args.length > 1 && user.isAuthorized("essentials.kit.others"))
{
- final User userTo = getPlayer(server, args, 1, true);
+ final User userTo = getPlayer(server, user, args, 1);
final String kitName = Util.sanitizeString(args[0].toLowerCase(Locale.ENGLISH)).trim();
giveKit(userTo, user, kitName);
}
@@ -52,7 +52,7 @@ public class Commandkit extends EssentialsCommand
}
else
{
- final User userTo = getPlayer(server, args, 1, true);
+ final User userTo = getPlayer(server, args, 1, true, false);
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
index 2376ca422..6e7f80b58 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
@@ -23,7 +23,7 @@ public class Commandmute extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User player = getPlayer(server, args, 0, true);
+ final User player = getPlayer(server, args, 0, true, true);
if (sender instanceof Player && !player.isMuted() && player.isAuthorized("essentials.mute.exempt"))
{
throw new Exception(_("muteExempt"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
index c13c1489d..294939f8f 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java
@@ -32,7 +32,7 @@ public class Commandnear extends EssentialsCommand
{
try
{
- otherUser = getPlayer(server, args, 0);
+ otherUser = getPlayer(server, user, args, 0);
}
catch (Exception ex)
{
@@ -66,7 +66,7 @@ public class Commandnear extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- final User otherUser = getPlayer(server, args, 0);
+ final User otherUser = getPlayer(server, args, 0, true, false);
long radius = 200;
if (args.length > 1)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
index 749b7a9ad..b7cf4b32d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
@@ -33,7 +33,7 @@ public class Commandnick extends EssentialsCommand
{
throw new Exception(_("nickOthersPermission"));
}
- setNickname(server, getPlayer(server, args, 0), formatNickname(user, args[1]));
+ setNickname(server, getPlayer(server, user, args, 0), formatNickname(user, args[1]));
user.sendMessage(_("nickChanged"));
return;
}
@@ -57,7 +57,7 @@ public class Commandnick extends EssentialsCommand
}
else
{
- setNickname(server, getPlayer(server, args, 0), formatNickname(null, args[1]));
+ setNickname(server, getPlayer(server, args, 0, true, false), formatNickname(null, args[1]));
}
sender.sendMessage(_("nickChanged"));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 5c43898a8..35694053e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -35,7 +35,7 @@ public class Commandspawnmob extends EssentialsCommand
if (args.length >= 3)
{
- final User target = getPlayer(ess.getServer(), args, 2);
+ final User target = getPlayer(ess.getServer(), user, args, 2);
SpawnMob.spawnmob(ess, server, user, target, mobData, mobCount);
return;
}
@@ -55,7 +55,7 @@ public class Commandspawnmob extends EssentialsCommand
String[] mobData = SpawnMob.mobData(args[0]);
int mobCount = Integer.parseInt(args[1]);
- final User target = getPlayer(ess.getServer(), args, 2);
+ final User target = getPlayer(ess.getServer(), args, 2, true, false);
SpawnMob.spawnmob(ess, server, sender, target, mobData, mobCount);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
index 6efa138c6..b0df89a67 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
@@ -27,7 +27,7 @@ public class Commandsudo extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User user = getPlayer(server, args, 0, false);
+ final User user = getPlayer(server, args, 0);
if(args[1].toLowerCase(Locale.ENGLISH).startsWith("c:"))
{
if (user.isAuthorized("essentials.sudo.exempt") && sender instanceof Player)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
index cf706aa8b..b0384d5d0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
@@ -24,7 +24,7 @@ public class Commandtempban extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
- final User user = getPlayer(server, args, 0, true);
+ final User user = getPlayer(server, args, 0, true, true);
if (!user.isOnline())
{
if (sender instanceof Player
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
index 3240b73a9..70a922b7c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java
@@ -23,7 +23,7 @@ public class Commandtogglejail extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User player = getPlayer(server, args, 0, true);
+ final User player = getPlayer(server, args, 0, true, true);
if (args.length >= 2 && !player.isJailed())
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index 504730306..50c239c38 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -22,8 +22,8 @@ public class Commandtpo extends EssentialsCommand
throw new NotEnoughArgumentsException();
case 1:
- final User player = getPlayer(server, args, 0, true);
- if (!player.isOnline() || (player.isHidden() && !user.isAuthorized("essentials.teleport.hidden")))
+ final User player = getPlayer(server, args, 0, true, false);
+ if (player.isHidden() && !user.isAuthorized("essentials.teleport.hidden"))
{
throw new NoSuchFieldException(_("playerNotFound"));
}
@@ -42,11 +42,10 @@ public class Commandtpo extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.tp.others"));
}
user.sendMessage(_("teleporting"));
- final User target = getPlayer(server, args, 0, true);
- final User toPlayer = getPlayer(server, args, 1, true);
+ final User target = getPlayer(server, args, 0, true, false);
+ final User toPlayer = getPlayer(server, args, 1, true, false);
- if (!target.isOnline() || !toPlayer.isOnline()
- || ((target.isHidden() || toPlayer.isHidden()) && !user.isAuthorized("essentials.teleport.hidden")))
+ if ((target.isHidden() || toPlayer.isHidden()) && !user.isAuthorized("essentials.teleport.hidden"))
{
throw new NoSuchFieldException(_("playerNotFound"));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
index 23db7dd39..50f4d74fe 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java
@@ -22,13 +22,7 @@ public class Commandtpohere extends EssentialsCommand
}
//Just basically the old tphere command
- final User player = getPlayer(server, args, 0, true);
-
- // Check if user is offline
- if (!player.isOnline())
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
+ final User player = getPlayer(server, args, 0, true, false);
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
index 16e5c3fcf..b1a41fc4c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
@@ -55,7 +55,7 @@ public class Commandtppos extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- User user = getPlayer(server, args, 0);
+ User user = getPlayer(server, args, 0, true, false);
final double x = args[1].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
final double y = args[2].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
final double z = args[3].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[3].substring(1)) : Integer.parseInt(args[3]);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
index 92b30b884..718f7f2ed 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
@@ -27,7 +27,7 @@ public class Commandunban extends EssentialsCommand
String name;
try
{
- final User user = getPlayer(server, args, 0, true);
+ final User user = getPlayer(server, args, 0, true, true);
name = user.getName();
user.setBanned(false);
user.setBanTimeout(0);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
index 4a980e291..15bb8f5c2 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java
@@ -31,7 +31,7 @@ public class Commandunbanip extends EssentialsCommand
}
else
{
- final User user = getPlayer(server, args, 0, true);
+ final User user = getPlayer(server, args, 0, true, true);
ipAddress = user.getLastLoginAddress();
if (ipAddress.isEmpty())
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
index fb7f420a8..c70490c3f 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
@@ -28,7 +28,7 @@ public class Commandunlimited extends EssentialsCommand
if (args.length > 1 && user.isAuthorized("essentials.unlimited.others"))
{
- target = getPlayer(server, args, 1);
+ target = getPlayer(server, user, args, 1);
}
if (args[0].equalsIgnoreCase("list"))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index 9e22ce9d5..dab972b26 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -41,7 +41,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);
+ otherUser = getPlayer(server, args, 1, user.isAuthorized("essentials.teleport.hidden"), false);
warpUser(user, otherUser, args[0]);
throw new NoChargeException();
}
@@ -58,7 +58,7 @@ public class Commandwarp extends EssentialsCommand
warpList(sender, args);
throw new NoChargeException();
}
- User otherUser = getPlayer(server, args, 1);
+ User otherUser = getPlayer(server, args, 1, true, false);
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
throw new NoChargeException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
index 5287016eb..0573c02d8 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
@@ -45,10 +45,15 @@ public abstract class EssentialsCommand implements IEssentialsCommand
protected User getPlayer(final Server server, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
{
- return getPlayer(server, args, pos, false);
+ return getPlayer(server, args, pos, false, false);
+ }
+
+ protected User getPlayer(final Server server, final User user, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException
+ {
+ return getPlayer(server, args, pos, user.isAuthorized("essentials.vanish.interact"), false);
}
- protected User getPlayer(final Server server, final String[] args, final int pos, final boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException
+ protected User getPlayer(final Server server, final String[] args, final int pos, boolean getHidden, final boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException
{
if (args.length <= pos)
{
@@ -61,7 +66,11 @@ public abstract class EssentialsCommand implements IEssentialsCommand
final User user = ess.getUser(args[pos]);
if (user != null)
{
- if (!getOffline && (!user.isOnline() || user.isHidden()))
+ if (!getOffline && !user.isOnline())
+ {
+ throw new PlayerNotFoundException();
+ }
+ if (!getHidden && user.isHidden())
{
throw new PlayerNotFoundException();
}
@@ -74,13 +83,13 @@ public abstract class EssentialsCommand implements IEssentialsCommand
for (Player player : matches)
{
final User userMatch = ess.getUser(player);
- if (userMatch.getDisplayName().startsWith(args[pos]) && (getOffline || !userMatch.isHidden()))
+ if (userMatch.getDisplayName().startsWith(args[pos]) && (getHidden || !userMatch.isHidden()))
{
return userMatch;
}
}
final User userMatch = ess.getUser(matches.get(0));
- if (getOffline || !userMatch.isHidden())
+ if (getHidden || !userMatch.isHidden())
{
return userMatch;
}