mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 12:01:20 +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:
@@ -30,17 +30,20 @@ public class Commandbalance extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
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();
|
final BigDecimal bal = user.getMoney();
|
||||||
user.sendMessage(_("balance", NumberUtil.displayCurrency(bal, ess)));
|
user.sendMessage(_("balance", NumberUtil.displayCurrency(bal, ess)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final User target = getPlayer(server, args, 0, true, true);
|
throw new NotEnoughArgumentsException();
|
||||||
final BigDecimal bal = target.getMoney();
|
|
||||||
user.sendMessage(_("balanceOther", target.getDisplayName(), NumberUtil.displayCurrency(bal, ess)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user