diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index ab84fb9d9..9891c4746 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -47,9 +47,14 @@ public abstract class EssentialsCommand implements IEssentialsCommand { return getPlayer(server, user, args, pos, user.isAuthorized("essentials.vanish.interact"), false); } - + protected User getPlayer(final Server server, final CommandSender sender, final String[] args, final int pos) throws NoSuchFieldException, NotEnoughArgumentsException { + if (sender instanceof Player) + { + User user = ess.getUser(sender); + return getPlayer(server, user, args, pos); + } return getPlayer(server, null, args, pos, true, false); } @@ -57,7 +62,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { return getPlayer(server, null, args, pos, getHidden, getOffline); } - + private User getPlayer(final Server server, final User sourceUser, final String[] args, final int pos, boolean getHidden, final boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException { if (args.length <= pos) @@ -75,7 +80,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { throw new PlayerNotFoundException(); } - if (!getHidden && user.isHidden() || user.equals(sourceUser)) + if (!getHidden && user.isHidden() && !user.equals(sourceUser)) { throw new PlayerNotFoundException(); } |