diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index b28346ae1..c6b42f16c 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 @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - if (args.length < 2 || args[0].trim().isEmpty() || args[1].trim().isEmpty()) + if (args.length < 2 || args[0].trim().length() < 3 || args[1].trim().isEmpty()) { throw new NotEnoughArgumentsException(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index f79f0150b..1299aa6e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -16,14 +16,14 @@ public class Commandpay extends EssentialsCommand throw new NotEnoughArgumentsException(); } - if (args[0] == "") + if (args[0].trim().length() < 3) { throw new NotEnoughArgumentsException("You need to specify a player to pay."); } double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); - Boolean foundUser = false; + boolean foundUser = false; for (Player p : server.matchPlayer(args[0])) { IUser u = ess.getUser(p); @@ -36,7 +36,7 @@ public class Commandpay extends EssentialsCommand foundUser = true; } - if (foundUser == false) + if (!foundUser) { throw new NoSuchFieldException(_("playerNotFound")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index cc3a876ec..e8ad59361 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -40,6 +40,7 @@ public class Commandwhois extends EssentialsCommand ISettings settings = ess.getSettings(); settings.acquireReadLock(); final int prefixLength = Util.stripColor(settings.getData().getChat().getNicknamePrefix()).length(); + boolean foundPlayer = false; for (Player onlinePlayer : server.getOnlinePlayers()) { @Cleanup @@ -57,6 +58,7 @@ public class Commandwhois extends EssentialsCommand { continue; } + foundPlayer = true; sender.sendMessage(""); user.setDisplayNick(); sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName())); @@ -82,6 +84,10 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(_("whoisGeoLocation", location)); } + if (!foundPlayer) + { + throw new NoSuchFieldException(_("playerNotFound")); + } } } }