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 cc1ae2c243
commit 0d9db22d81

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