mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-23 23:31:05 +01:00
fix: don't register balance commands as main currency command
This commit is contained in:
parent
9c0968ded2
commit
b7c90ae5c8
2 changed files with 7 additions and 11 deletions
|
@ -34,7 +34,7 @@ public class BalanceCommand implements Command {
|
|||
};
|
||||
}
|
||||
|
||||
private void handleBalance(CommandSender originalSender, CommandArguments args, Currency currency) {
|
||||
public void handleBalance(CommandSender originalSender, CommandArguments args, Currency currency) {
|
||||
BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory);
|
||||
OfflinePlayer target = (OfflinePlayer) args.get("target");
|
||||
|
||||
|
|
|
@ -57,21 +57,17 @@ public class BukkitCommandManager extends AbstractCommandManager {
|
|||
private void registerCommands(@NonNull String name, @NonNull Currency currency) {
|
||||
String permissionBase = "lighteco.currency." + currency.getIdentifier() + ".command.";
|
||||
|
||||
// Balance
|
||||
for (CommandAPICommand cmd : new BalanceCommand(
|
||||
this,
|
||||
name,
|
||||
currency,
|
||||
permissionBase
|
||||
).multipleBuild()) {
|
||||
cmd.register();
|
||||
}
|
||||
BalanceCommand balanceCommand = new BalanceCommand(this, "balance", currency, permissionBase);
|
||||
|
||||
CommandAPICommand cmd = new CommandAPICommand(name)
|
||||
.withSubcommand(new SetCommand(this, currency, permissionBase).build())
|
||||
.withSubcommand(new GiveCommand(this, currency, permissionBase).build())
|
||||
.withSubcommand(new TakeCommand(this, currency, permissionBase).build())
|
||||
.withSubcommands(new BalanceCommand(this, "balance", currency, permissionBase).multipleBuild());
|
||||
.withSubcommands(balanceCommand.multipleBuild())
|
||||
// We want balance to be the default command
|
||||
.executesPlayer((sender, args) -> {
|
||||
balanceCommand.handleBalance(sender, args, currency);
|
||||
});
|
||||
|
||||
if (currency.isPayable())
|
||||
cmd = cmd.withSubcommand(new PayCommand(this, currency, permissionBase).build());
|
||||
|
|
Loading…
Reference in a new issue