diff options
author | Necrodoom <doomed.war@gmail.com> | 2013-08-05 10:50:34 +0300 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-08-05 16:04:28 +0100 |
commit | 0d9db22d8125b48ee15819dfe9fa36ae86f5caf0 (patch) | |
tree | bc32b51a6873950532c3034719ef17b5c1bddd39 | |
parent | cc1ae2c243fdcce5506a064cc5b62b4264609c74 (diff) | |
download | Essentials-0d9db22d8125b48ee15819dfe9fa36ae86f5caf0.tar Essentials-0d9db22d8125b48ee15819dfe9fa36ae86f5caf0.tar.gz Essentials-0d9db22d8125b48ee15819dfe9fa36ae86f5caf0.tar.lz Essentials-0d9db22d8125b48ee15819dfe9fa36ae86f5caf0.tar.xz Essentials-0d9db22d8125b48ee15819dfe9fa36ae86f5caf0.zip |
display syntax if more than one argument to avoid confusion with command purpose
more clearly, show syntax when people try to do /money give playername amount
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandbalance.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index 8e8452ec8..ce0d03437 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -30,17 +30,20 @@ public class Commandbalance extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - - if (args.length < 1 || !user.isAuthorized("essentials.balance.others")) + if (args.length == 1 && user.isAuthorized("essentials.balance.others")) + { + final User target = getPlayer(server, args, 0, true, true); + final BigDecimal bal = target.getMoney(); + user.sendMessage(_("balanceOther", target.getDisplayName(), NumberUtil.displayCurrency(bal, ess))); + } + else if (args.length < 2) { final BigDecimal bal = user.getMoney(); user.sendMessage(_("balance", NumberUtil.displayCurrency(bal, ess))); } else { - final User target = getPlayer(server, args, 0, true, true); - final BigDecimal bal = target.getMoney(); - user.sendMessage(_("balanceOther", target.getDisplayName(), NumberUtil.displayCurrency(bal, ess))); + throw new NotEnoughArgumentsException(); } } } |