summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandheal.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandheal.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
index aaf9617ad..b26d5bdfd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java
@@ -50,19 +50,22 @@ public class Commandheal extends EssentialsCommand
private void healOtherPlayers(final Server server, final CommandSender sender, final String name) throws Exception
{
- final List<Player> players = server.matchPlayer(name);
- if (players.isEmpty())
- {
- throw new Exception(_("playerNotFound"));
- }
- for (Player p : players)
+
+ boolean foundUser = false;
+ final List<Player> matchedPlayers = server.matchPlayer(name);
+ for (Player matchPlayer : matchedPlayers)
{
- if (ess.getUser(p).isHidden())
+ if (ess.getUser(matchPlayer).isHidden())
{
continue;
}
- healPlayer(p);
- sender.sendMessage(_("healOther", p.getDisplayName()));
+ foundUser = true;
+ healPlayer(matchPlayer);
+ sender.sendMessage(_("healOther", matchPlayer.getDisplayName()));
+ }
+ if (!foundUser)
+ {
+ throw new NotEnoughArgumentsException(_("playerNotFound"));
}
}