mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 13:13:24 +00:00
![Ali 'SupaHam' M](/assets/img/avatar_default.png)
List of supported commands: ``` /afk /balance /balancetop /ban /banip /bigtree /book /broadcastworld /burn /clearinventory /condense /delhome /deljail /delwarp /eco /enchant /enderchest /essentials /exp /ext /feed /fireball /firework /gamemode /getpos /give /hat /heal /help /helpop /home /ignore /invsee /item /itemdb /jump /kick /kill /kit /lightning /list /mail /me /msg /mute /near /nick /nuke /pay /potion /powertool /ptime /pweather /recipe /remove /repair /sell /showkit /skull /speed /tempban /thunder /time /togglejail /tp /tpa /tpaall /tpahere /tpall /tphere /tpo /tpohere /tppos /tree /warp /weather /world /worth```
61 lines
2.3 KiB
Java
61 lines
2.3 KiB
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.CommandSource;
|
|
import com.earth2me.essentials.User;
|
|
import com.earth2me.essentials.utils.NumberUtil;
|
|
import org.bukkit.Server;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
|
|
|
|
|
public class Commandbalance extends EssentialsCommand {
|
|
public Commandbalance() {
|
|
super("balance");
|
|
}
|
|
|
|
@Override
|
|
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
|
if (args.length < 1) {
|
|
throw new NotEnoughArgumentsException();
|
|
}
|
|
|
|
User target = getPlayer(server, args, 0, true, true);
|
|
sender.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(target.getMoney(), ess)));
|
|
}
|
|
|
|
@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")) {
|
|
final User target = getPlayer(server, args, 0, true, true);
|
|
final BigDecimal bal = target.getMoney();
|
|
user.sendMessage(tl("balanceOther", target.isHidden() ? target.getName() : target.getDisplayName(), NumberUtil.displayCurrency(bal, ess)));
|
|
} else if (args.length < 2) {
|
|
final BigDecimal bal = user.getMoney();
|
|
user.sendMessage(tl("balance", NumberUtil.displayCurrency(bal, ess)));
|
|
} else {
|
|
throw new NotEnoughArgumentsException();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
|
|
if (args.length == 1 && user.isAuthorized("essentials.balance.others")) {
|
|
return getPlayers(server, user);
|
|
} else {
|
|
return Collections.emptyList();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected List<String> getTabCompleteOptions(Server server, CommandSource sender, String commandLabel, String[] args) {
|
|
if (args.length == 1) {
|
|
return getPlayers(server, sender);
|
|
} else {
|
|
return Collections.emptyList();
|
|
}
|
|
}
|
|
}
|