summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNecrodoom <doomed.war@gmail.com>2013-08-05 10:50:34 +0300
committerKHobbits <rob@khobbits.co.uk>2013-08-05 16:04:28 +0100
commit0d9db22d8125b48ee15819dfe9fa36ae86f5caf0 (patch)
treebc32b51a6873950532c3034719ef17b5c1bddd39
parentcc1ae2c243fdcce5506a064cc5b62b4264609c74 (diff)
downloadEssentials-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.java13
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();
}
}
}