1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-17 20:11:21 +02:00

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
This commit is contained in:
Necrodoom
2013-08-05 10:50:34 +03:00
committed by KHobbits
parent f86ac7e8a7
commit 6b0d76b0eb

View File

@@ -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();
}
}
}