From 9305b33f131d0895b084315b24c0f96109ab0086 Mon Sep 17 00:00:00 2001 From: xHyroM Date: Sun, 27 Aug 2023 13:23:10 +0200 Subject: [PATCH] feat: allow global cmds registration for one currency --- .../lighteco/api/manager/CommandManager.java | 1 + .../bukkit/commands/BalanceCommand.java | 57 ++++++ .../lighteco/bukkit/commands/Command.java | 14 ++ .../lighteco/bukkit/commands/GiveCommand.java | 54 +++++ .../lighteco/bukkit/commands/PayCommand.java | 53 +++++ .../lighteco/bukkit/commands/SetCommand.java | 54 +++++ .../lighteco/bukkit/commands/TakeCommand.java | 54 +++++ .../bukkit/manager/BukkitCommandManager.java | 184 +++--------------- .../common/api/impl/ApiCommandManager.java | 13 +- .../xhyrom/lighteco/common/config/Config.java | 6 +- .../common/config/storage/StorageConfig.java | 18 ++ .../config/storage/StorageDataConfig.java | 16 ++ .../command/AbstractCommandManager.java | 2 +- .../manager/command/CommandManager.java | 1 + .../common/storage/StorageFactory.java | 2 +- 15 files changed, 363 insertions(+), 166 deletions(-) create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/GiveCommand.java create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/SetCommand.java create mode 100644 bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/TakeCommand.java create mode 100644 common/src/main/java/dev/xhyrom/lighteco/common/config/storage/StorageConfig.java create mode 100644 common/src/main/java/dev/xhyrom/lighteco/common/config/storage/StorageDataConfig.java diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/manager/CommandManager.java b/api/src/main/java/dev/xhyrom/lighteco/api/manager/CommandManager.java index 8097f14..ef3524a 100644 --- a/api/src/main/java/dev/xhyrom/lighteco/api/manager/CommandManager.java +++ b/api/src/main/java/dev/xhyrom/lighteco/api/manager/CommandManager.java @@ -5,4 +5,5 @@ import org.checkerframework.checker.nullness.qual.NonNull; public interface CommandManager { void registerCurrencyCommand(@NonNull Currency currency); + void registerCurrencyCommand(@NonNull Currency currency, boolean main); } diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java new file mode 100644 index 0000000..1fb2ac7 --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java @@ -0,0 +1,57 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.arguments.OfflinePlayerArgument; +import dev.jorel.commandapi.executors.CommandArguments; +import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.manager.BukkitCommandManager; +import dev.xhyrom.lighteco.common.model.currency.Currency; +import lombok.RequiredArgsConstructor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.util.List; + +@RequiredArgsConstructor +public class BalanceCommand implements Command { + private final BukkitCommandManager manager; + private final String name; + private final Currency currency; + private final String permissionBase; + + @Override + public CommandAPICommand[] multipleBuild() { + return new CommandAPICommand[]{ + new CommandAPICommand(name) + .withPermission(permissionBase + "balance.others") + .withArguments(new OfflinePlayerArgument("target")) + .executes((sender, args) -> { + this.handleBalance(sender, args, currency); + }), + new CommandAPICommand(name) + .withPermission(permissionBase + "balance") + .executesPlayer((sender, args) -> { + this.handleBalance(sender, args, currency); + }) + }; + } + + private void handleBalance(CommandSender originalSender, CommandArguments args, Currency currency) { + BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory); + OfflinePlayer target = (OfflinePlayer) args.get("target"); + + if (target == null) { + this.manager.onBalance(sender, currency); + + return; + } + + this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) + .thenAcceptAsync(result -> { + String name = target.getName() != null ? target.getName() : args.getRaw("target"); + result.setUsername(name); + + this.manager.onBalance(sender, currency, result); + }); + } +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java new file mode 100644 index 0000000..1ec3b6e --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java @@ -0,0 +1,14 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; + +import java.util.List; + +public interface Command { + default CommandAPICommand build() { + return null; + }; + default CommandAPICommand[] multipleBuild() { + return null; + }; +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/GiveCommand.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/GiveCommand.java new file mode 100644 index 0000000..1f921cb --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/GiveCommand.java @@ -0,0 +1,54 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.arguments.DoubleArgument; +import dev.jorel.commandapi.arguments.IntegerArgument; +import dev.jorel.commandapi.arguments.OfflinePlayerArgument; +import dev.jorel.commandapi.executors.CommandArguments; +import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.manager.BukkitCommandManager; +import dev.xhyrom.lighteco.common.model.currency.Currency; +import lombok.RequiredArgsConstructor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.math.BigDecimal; + +@RequiredArgsConstructor +public class GiveCommand implements Command { + private final BukkitCommandManager manager; + private final Currency currency; + private final String permissionBase; + + @Override + public CommandAPICommand build() { + return new CommandAPICommand("give") + .withPermission(permissionBase + "give") + .withArguments( + new OfflinePlayerArgument("target"), + currency.getProxy().getDecimalPlaces() > 0 + ? new DoubleArgument("amount", 1) + : new IntegerArgument("amount", 1) + ) + .executes((sender, args) -> { + this.handleGive(sender, args, currency); + }); + } + + + private void handleGive(CommandSender originalSender, CommandArguments args, Currency currency) { + BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory); + OfflinePlayer target = (OfflinePlayer) args.get("target"); + BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); + + if (!this.manager.canUse(sender)) return; + + this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) + .thenAcceptAsync(result -> { + String name = target.getName() != null ? target.getName() : args.getRaw("target"); + result.setUsername(name); + + this.manager.onGive(sender, currency, result, amount); + }); + } +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java new file mode 100644 index 0000000..cffda49 --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java @@ -0,0 +1,53 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.arguments.DoubleArgument; +import dev.jorel.commandapi.arguments.IntegerArgument; +import dev.jorel.commandapi.arguments.OfflinePlayerArgument; +import dev.jorel.commandapi.executors.CommandArguments; +import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.manager.BukkitCommandManager; +import dev.xhyrom.lighteco.common.model.currency.Currency; +import lombok.RequiredArgsConstructor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.math.BigDecimal; + +@RequiredArgsConstructor +public class PayCommand implements Command { + private final BukkitCommandManager manager; + private final Currency currency; + private final String permissionBase; + + @Override + public CommandAPICommand build() { + return new CommandAPICommand("pay") + .withPermission(permissionBase + "pay") + .withArguments( + new OfflinePlayerArgument("target"), + currency.getProxy().getDecimalPlaces() > 0 + ? new DoubleArgument("amount", 1) + : new IntegerArgument("amount", 1) + ) + .executesPlayer((sender, args) -> { + this.handlePay(sender, args, currency); + }); + } + + private void handlePay(CommandSender originalSender, CommandArguments args, Currency currency) { + BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory); + OfflinePlayer target = (OfflinePlayer) args.get("target"); + BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); + + if (!this.manager.canUse(sender)) return; + + this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) + .thenAcceptAsync(result -> { + String name = target.getName() != null ? target.getName() : args.getRaw("target"); + result.setUsername(name); + + this.manager.onPay(sender, currency, result, amount); + }); + } +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/SetCommand.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/SetCommand.java new file mode 100644 index 0000000..819f44b --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/SetCommand.java @@ -0,0 +1,54 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.arguments.DoubleArgument; +import dev.jorel.commandapi.arguments.IntegerArgument; +import dev.jorel.commandapi.arguments.OfflinePlayerArgument; +import dev.jorel.commandapi.executors.CommandArguments; +import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.manager.BukkitCommandManager; +import dev.xhyrom.lighteco.common.model.currency.Currency; +import lombok.RequiredArgsConstructor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.math.BigDecimal; + +@RequiredArgsConstructor +public class SetCommand implements Command { + private final BukkitCommandManager manager; + private final Currency currency; + private final String permissionBase; + + @Override + public CommandAPICommand build() { + return new CommandAPICommand("set") + .withPermission(permissionBase + "set") + .withArguments( + new OfflinePlayerArgument("target"), + currency.getProxy().getDecimalPlaces() > 0 + ? new DoubleArgument("amount", 0) + : new IntegerArgument("amount", 0) + ) + .executes((sender, args) -> { + this.handleSet(sender, args, currency); + }); + } + + + private void handleSet(CommandSender originalSender, CommandArguments args, Currency currency) { + BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory); + OfflinePlayer target = (OfflinePlayer) args.get("target"); + BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); + + if (!this.manager.canUse(sender)) return; + + this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) + .thenAcceptAsync(result -> { + String name = target.getName() != null ? target.getName() : args.getRaw("target"); + result.setUsername(name); + + this.manager.onSet(sender, currency, result, amount); + }); + } +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/TakeCommand.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/TakeCommand.java new file mode 100644 index 0000000..08e3127 --- /dev/null +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/TakeCommand.java @@ -0,0 +1,54 @@ +package dev.xhyrom.lighteco.bukkit.commands; + +import dev.jorel.commandapi.CommandAPICommand; +import dev.jorel.commandapi.arguments.DoubleArgument; +import dev.jorel.commandapi.arguments.IntegerArgument; +import dev.jorel.commandapi.arguments.OfflinePlayerArgument; +import dev.jorel.commandapi.executors.CommandArguments; +import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.manager.BukkitCommandManager; +import dev.xhyrom.lighteco.common.model.currency.Currency; +import lombok.RequiredArgsConstructor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; + +import java.math.BigDecimal; + +@RequiredArgsConstructor +public class TakeCommand implements Command { + private final BukkitCommandManager manager; + private final Currency currency; + private final String permissionBase; + + @Override + public CommandAPICommand build() { + return new CommandAPICommand("take") + .withPermission(permissionBase + "take") + .withArguments( + new OfflinePlayerArgument("target"), + currency.getProxy().getDecimalPlaces() > 0 + ? new DoubleArgument("amount", 1) + : new IntegerArgument("amount", 1) + ) + .executes((sender, args) -> { + this.handleTake(sender, args, currency); + }); + } + + + private void handleTake(CommandSender originalSender, CommandArguments args, Currency currency) { + BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.manager.audienceFactory); + OfflinePlayer target = (OfflinePlayer) args.get("target"); + BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); + + if (!this.manager.canUse(sender)) return; + + this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) + .thenAcceptAsync(result -> { + String name = target.getName() != null ? target.getName() : args.getRaw("target"); + result.setUsername(name); + + this.manager.onTake(sender, currency, result, amount); + }); + } +} diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/manager/BukkitCommandManager.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/manager/BukkitCommandManager.java index 2b5a549..ec3d88d 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/manager/BukkitCommandManager.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/manager/BukkitCommandManager.java @@ -1,26 +1,16 @@ package dev.xhyrom.lighteco.bukkit.manager; -import dev.jorel.commandapi.CommandAPI; import dev.jorel.commandapi.CommandAPICommand; -import dev.jorel.commandapi.arguments.DoubleArgument; -import dev.jorel.commandapi.arguments.IntegerArgument; -import dev.jorel.commandapi.arguments.OfflinePlayerArgument; -import dev.jorel.commandapi.executors.CommandArguments; -import dev.xhyrom.lighteco.bukkit.chat.BukkitCommandSender; +import dev.xhyrom.lighteco.bukkit.commands.*; import dev.xhyrom.lighteco.common.manager.command.AbstractCommandManager; import dev.xhyrom.lighteco.common.model.currency.Currency; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; import org.bukkit.plugin.java.JavaPlugin; import org.checkerframework.checker.nullness.qual.NonNull; -import java.math.BigDecimal; -import java.util.List; - public class BukkitCommandManager extends AbstractCommandManager { - private final BukkitAudiences audienceFactory; + public final BukkitAudiences audienceFactory; public BukkitCommandManager(LightEcoPlugin plugin) { super(plugin); @@ -28,166 +18,42 @@ public class BukkitCommandManager extends AbstractCommandManager { this.audienceFactory = BukkitAudiences.create((JavaPlugin) this.plugin.getBootstrap().getLoader()); } - private List getBalanceCommands(String name, String permissionBase, Currency currency) { - return List.of( - new CommandAPICommand(name) - .withPermission(permissionBase + "balance.others") - .withArguments(new OfflinePlayerArgument("target")) - .executes((sender, args) -> { - this.handleBalance(sender, args, currency); - }), - new CommandAPICommand(name) - .withPermission(permissionBase + "balance") - .executesPlayer((sender, args) -> { - this.handleBalance(sender, args, currency); - }) - ); - } - @Override public void registerCurrencyCommand(@NonNull Currency currency) { String permissionBase = "lighteco.currency." + currency.getIdentifier() + ".command."; // Balance - getBalanceCommands(currency.getIdentifier(), permissionBase, currency) - .forEach(CommandAPICommand::register); - - List balanceCommands = getBalanceCommands("balance", permissionBase, currency); + for (CommandAPICommand cmd : new BalanceCommand( + this, + currency.getIdentifier(), + currency, + permissionBase + ).multipleBuild()) { + cmd.register(); + } new CommandAPICommand(currency.getIdentifier()) - .withSubcommand(new CommandAPICommand("set") - .withPermission(permissionBase + "set") - .withArguments( - new OfflinePlayerArgument("target"), - currency.getProxy().getDecimalPlaces() > 0 - ? new DoubleArgument("amount", 0) - : new IntegerArgument("amount", 0) - ) - .executes((sender, args) -> { - this.handleSet(sender, args, currency); - }) - ) - .withSubcommand(new CommandAPICommand("give") - .withPermission(permissionBase + "give") - .withArguments( - new OfflinePlayerArgument("target"), - currency.getProxy().getDecimalPlaces() > 0 - ? new DoubleArgument("amount", 1) - : new IntegerArgument("amount", 1) - ) - .executes((sender, args) -> { - this.handleGive(sender, args, currency); - }) - ) - .withSubcommand(new CommandAPICommand("take") - .withPermission(permissionBase + "take") - .withArguments( - new OfflinePlayerArgument("target"), - currency.getProxy().getDecimalPlaces() > 0 - ? new DoubleArgument("amount", 1) - : new IntegerArgument("amount", 1) - ) - .executes((sender, args) -> { - this.handleTake(sender, args, currency); - }) - ) - .withSubcommand(new CommandAPICommand("pay") - .withPermission(permissionBase + "pay") - .withArguments( - new OfflinePlayerArgument("target"), - currency.getProxy().getDecimalPlaces() > 0 - ? new DoubleArgument("amount", 1) - : new IntegerArgument("amount", 1) - ) - .executesPlayer((sender, args) -> { - this.handlePay(sender, args, currency); - }) - ) - .withSubcommand(balanceCommands.get(0)) - .withSubcommands(balanceCommands.get(1)) + .withSubcommand(new SetCommand(this, currency, permissionBase).build()) + .withSubcommand(new GiveCommand(this, currency, permissionBase).build()) + .withSubcommand(new TakeCommand(this, currency, permissionBase).build()) + .withSubcommand(new PayCommand(this, currency, permissionBase).build()) + .withSubcommands(new BalanceCommand(this, "balance", currency, permissionBase).multipleBuild()) .register(); } - private void handleBalance(CommandSender originalSender, CommandArguments args, Currency currency) { - BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.audienceFactory); - OfflinePlayer target = (OfflinePlayer) args.get("target"); - - if (target == null) { - this.onBalance(sender, currency); - + @Override + public void registerCurrencyCommand(@NonNull Currency currency, boolean main) { + if (!main) { + registerCurrencyCommand(currency); return; } - this.plugin.getUserManager().loadUser(target.getUniqueId()) - .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); + String permissionBase = "lighteco.currency." + currency.getIdentifier() + ".command."; - this.onBalance(sender, currency, result); - }); - } - - private void handleSet(CommandSender originalSender, CommandArguments args, Currency currency) { - BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.audienceFactory); - OfflinePlayer target = (OfflinePlayer) args.get("target"); - BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); - - if (!this.canUse(sender)) return; - - this.plugin.getUserManager().loadUser(target.getUniqueId()) - .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); - - this.onSet(sender, currency, result, amount); - }); - } - - private void handleGive(CommandSender originalSender, CommandArguments args, Currency currency) { - BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.audienceFactory); - OfflinePlayer target = (OfflinePlayer) args.get("target"); - BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); - - if (!this.canUse(sender)) return; - - this.plugin.getUserManager().loadUser(target.getUniqueId()) - .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); - - this.onGive(sender, currency, result, amount); - }); - } - - private void handleTake(CommandSender originalSender, CommandArguments args, Currency currency) { - BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.audienceFactory); - OfflinePlayer target = (OfflinePlayer) args.get("target"); - BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); - - if (!this.canUse(sender)) return; - - this.plugin.getUserManager().loadUser(target.getUniqueId()) - .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); - - this.onTake(sender, currency, result, amount); - }); - } - - private void handlePay(CommandSender originalSender, CommandArguments args, Currency currency) { - BukkitCommandSender sender = new BukkitCommandSender(originalSender, this.audienceFactory); - OfflinePlayer target = (OfflinePlayer) args.get("target"); - BigDecimal amount = BigDecimal.valueOf(Double.parseDouble(args.getRaw("amount"))); - - if (!this.canUse(sender)) return; - - this.plugin.getUserManager().loadUser(target.getUniqueId()) - .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); - - this.onPay(sender, currency, result, amount); - }); + new SetCommand(this, currency, permissionBase).build().register(); + new GiveCommand(this, currency, permissionBase).build().register(); + new TakeCommand(this, currency, permissionBase).build().register(); + new PayCommand(this, currency, permissionBase).build().register(); + new BalanceCommand(this, "balance", currency, permissionBase).build().register(); } } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCommandManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCommandManager.java index 3bdc4af..0954065 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCommandManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCommandManager.java @@ -12,8 +12,17 @@ public class ApiCommandManager extends ApiAbstractManager mustWait = new ArrayList<>(); diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/CommandManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/CommandManager.java index 6b92aa2..39545cc 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/CommandManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/CommandManager.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; public interface CommandManager { void registerCurrencyCommand(@NonNull Currency currency); + void registerCurrencyCommand(@NonNull Currency currency, boolean main); boolean canUse(CommandSender sender); diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java index 2feb007..f9b2474 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/StorageFactory.java @@ -13,7 +13,7 @@ public class StorageFactory { public Storage get() { // todo: use config - String provider = this.plugin.getConfig().get("storage", String.class); + String provider = this.plugin.getConfig().storage.provider; return new Storage(this.plugin, createProvider(provider)); }