mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00: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:
parent
cc1ae2c243
commit
0d9db22d81
1 changed files with 8 additions and 5 deletions
|
@ -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)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue