From c52e9da63d969f11529c526287c57f5103bc761f Mon Sep 17 00:00:00 2001 From: xHyroM Date: Tue, 29 Aug 2023 09:13:25 +0200 Subject: [PATCH] refactor: sonarqube --- .../xhyrom/lighteco/api/event/EventBus.java | 11 ---------- .../lighteco/api/event/EventSubscription.java | 13 ------------ .../lighteco/api/event/LightEcoEvent.java | 10 --------- .../event/currency/CurrencyRegisterEvent.java | 11 ---------- .../lighteco/api/event/util/Position.java | 21 ------------------- .../lighteco/api/model/currency/Currency.java | 14 ++++++------- build.gradle.kts | 1 + .../bukkit/chat/BukkitCommandSender.java | 4 ++-- .../bukkit/commands/BalanceCommand.java | 8 +++++-- .../lighteco/bukkit/commands/Command.java | 9 ++++---- .../lighteco/bukkit/commands/PayCommand.java | 4 ++-- .../lighteco/bukkittest/TestCurrency.java | 2 +- .../lighteco/bukkittest/TestCurrency2.java | 2 +- .../lighteco/bukkittest/TestPlugin.java | 4 +--- .../common/api/impl/ApiCurrencyManager.java | 2 +- .../command/AbstractCommandManager.java | 8 +++---- .../currency/StandardCurrencyManager.java | 4 ---- .../model/chat/AbstractCommandSender.java | 2 +- .../common/plugin/AbstractLightEcoPlugin.java | 6 ++---- .../lighteco/common/storage/Storage.java | 8 +++---- .../memory/MemoryStorageProvider.java | 10 ++++++--- .../storage/provider/sql/SqlStatements.java | 3 +-- .../provider/sql/SqlStorageProvider.java | 1 - .../file/FileConnectionFactory.java | 3 +-- .../hikari/HikariConnectionFactory.java | 2 +- .../hikari/MariaDBConnectionFactory.java | 2 -- .../money/bukkit/hooks/vault/Vault.java | 2 +- .../listener/BukkitServiceListener.java | 15 ------------- .../currency/money/common/MoneyCurrency.java | 2 +- gradlew | 0 30 files changed, 49 insertions(+), 135 deletions(-) delete mode 100644 api/src/main/java/dev/xhyrom/lighteco/api/event/EventBus.java delete mode 100644 api/src/main/java/dev/xhyrom/lighteco/api/event/EventSubscription.java delete mode 100644 api/src/main/java/dev/xhyrom/lighteco/api/event/LightEcoEvent.java delete mode 100644 api/src/main/java/dev/xhyrom/lighteco/api/event/currency/CurrencyRegisterEvent.java delete mode 100644 api/src/main/java/dev/xhyrom/lighteco/api/event/util/Position.java delete mode 100644 currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/listener/BukkitServiceListener.java mode change 100644 => 100755 gradlew diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/event/EventBus.java b/api/src/main/java/dev/xhyrom/lighteco/api/event/EventBus.java deleted file mode 100644 index 401c9a3..0000000 --- a/api/src/main/java/dev/xhyrom/lighteco/api/event/EventBus.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.xhyrom.lighteco.api.event; - -import org.checkerframework.checker.nullness.qual.NonNull; - -import java.util.function.Consumer; - -public interface EventBus { - @NonNull EventSubscription subscribe(@NonNull Class eventClass, @NonNull Consumer subscriber); - - @NonNull EventSubscription subscribe(Object plugin, @NonNull Class eventClass, @NonNull Consumer subscriber); -} diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/event/EventSubscription.java b/api/src/main/java/dev/xhyrom/lighteco/api/event/EventSubscription.java deleted file mode 100644 index b530040..0000000 --- a/api/src/main/java/dev/xhyrom/lighteco/api/event/EventSubscription.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.xhyrom.lighteco.api.event; - -import org.checkerframework.checker.nullness.qual.NonNull; - -import java.util.function.Consumer; - -public interface EventSubscription extends AutoCloseable { - @NonNull Class getEventClass(); - - boolean isActive(); - - @NonNull Consumer getHandler(); -} diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/event/LightEcoEvent.java b/api/src/main/java/dev/xhyrom/lighteco/api/event/LightEcoEvent.java deleted file mode 100644 index e3ab9c3..0000000 --- a/api/src/main/java/dev/xhyrom/lighteco/api/event/LightEcoEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.xhyrom.lighteco.api.event; - -import dev.xhyrom.lighteco.api.LightEco; -import org.checkerframework.checker.nullness.qual.NonNull; - -public interface LightEcoEvent { - @NonNull LightEco getLightEco(); - - @NonNull Class getEventClass(); -} diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/event/currency/CurrencyRegisterEvent.java b/api/src/main/java/dev/xhyrom/lighteco/api/event/currency/CurrencyRegisterEvent.java deleted file mode 100644 index a7557f4..0000000 --- a/api/src/main/java/dev/xhyrom/lighteco/api/event/currency/CurrencyRegisterEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.xhyrom.lighteco.api.event.currency; - -import dev.xhyrom.lighteco.api.event.LightEcoEvent; -import dev.xhyrom.lighteco.api.event.util.Position; -import dev.xhyrom.lighteco.api.model.currency.Currency; -import org.checkerframework.checker.nullness.qual.NonNull; - -public interface CurrencyRegisterEvent extends LightEcoEvent { - @Position(0) - @NonNull Currency getCurrency(); -} diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/event/util/Position.java b/api/src/main/java/dev/xhyrom/lighteco/api/event/util/Position.java deleted file mode 100644 index 2f43124..0000000 --- a/api/src/main/java/dev/xhyrom/lighteco/api/event/util/Position.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.xhyrom.lighteco.api.event.util; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Represents the position (index) of a parameter within an event. - * Used for information purposes only. - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.SOURCE) -public @interface Position { - /** - * Represents the position (index) of a parameter. - * - * @return the position (index) - */ - int value(); -} diff --git a/api/src/main/java/dev/xhyrom/lighteco/api/model/currency/Currency.java b/api/src/main/java/dev/xhyrom/lighteco/api/model/currency/Currency.java index 7d18fd3..34a19fe 100644 --- a/api/src/main/java/dev/xhyrom/lighteco/api/model/currency/Currency.java +++ b/api/src/main/java/dev/xhyrom/lighteco/api/model/currency/Currency.java @@ -4,24 +4,24 @@ import dev.xhyrom.lighteco.api.model.user.User; import java.math.BigDecimal; -public abstract class Currency { - public abstract String getIdentifier(); +public interface Currency { + String getIdentifier(); /** * Get the type of the currency, either {@link Type#LOCAL} or {@link Type#GLOBAL} * * @see Type * @return The type of the currency */ - public abstract Type getType(); + Type getType(); - public abstract boolean isPayable(); + boolean isPayable(); /** * Get the number of fractional digits this currency has * * @return The number of fractional digits */ - public int fractionalDigits() { + default int fractionalDigits() { return 0; }; @@ -30,7 +30,7 @@ public abstract class Currency { * * @return The users */ - public abstract BigDecimal getDefaultBalance(); + BigDecimal getDefaultBalance(); /** * Calculate the tax for the given amount @@ -39,7 +39,7 @@ public abstract class Currency { * @param amount The amount to calculate the tax for * @return Amount that should be taxed */ - public BigDecimal calculateTax(User user, BigDecimal amount) { + default BigDecimal calculateTax(User user, BigDecimal amount) { return BigDecimal.ZERO; }; diff --git a/build.gradle.kts b/build.gradle.kts index 786d3e9..4335316 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ import java.io.ByteArrayOutputStream plugins { id("java") + id("org.sonarqube") version "4.2.1.3168" } val majorVersion = 0 diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/chat/BukkitCommandSender.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/chat/BukkitCommandSender.java index c2a5ad1..9bdce61 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/chat/BukkitCommandSender.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/chat/BukkitCommandSender.java @@ -25,8 +25,8 @@ public class BukkitCommandSender extends AbstractCommandSender { @Override public UUID getUniqueId() { - if (super.delegate instanceof Player) { - return ((Player) super.delegate).getUniqueId(); + if (super.delegate instanceof Player player) { + return player.getUniqueId(); } return null; 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 index b1b8769..cfde5d8 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/BalanceCommand.java @@ -46,8 +46,12 @@ public class BalanceCommand implements Command { this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) .thenAcceptAsync(result -> { - String name = target.getName() != null ? target.getName() : args.getRaw("target"); - result.setUsername(name); + String username = result.getUsername() == null ? + target.getName() != null + ? target.getName() + : args.getRaw("target") + : result.getUsername(); + result.setUsername(username); 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 index 1ec3b6e..30f56b6 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/Command.java @@ -2,13 +2,12 @@ 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; - }; + return new CommandAPICommand[0]; + } } 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 index 6257c2e..1d15542 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/commands/PayCommand.java @@ -44,12 +44,12 @@ public class PayCommand implements Command { this.manager.plugin.getUserManager().loadUser(target.getUniqueId()) .thenAcceptAsync(result -> { - String name = result.getUsername() == null ? + String username = result.getUsername() == null ? target.getName() != null ? target.getName() : args.getRaw("target") : result.getUsername(); - result.setUsername(name); + result.setUsername(username); this.manager.onPay(sender, currency, result, amount); }); diff --git a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency.java b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency.java index 96fceee..4652c83 100644 --- a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency.java +++ b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency.java @@ -4,7 +4,7 @@ import dev.xhyrom.lighteco.api.model.currency.Currency; import java.math.BigDecimal; -public class TestCurrency extends Currency { +public class TestCurrency implements Currency { @Override public String getIdentifier() { return "test"; diff --git a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency2.java b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency2.java index ed03b04..2b961ac 100644 --- a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency2.java +++ b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestCurrency2.java @@ -5,7 +5,7 @@ import dev.xhyrom.lighteco.api.model.user.User; import java.math.BigDecimal; -public class TestCurrency2 extends Currency { +public class TestCurrency2 implements Currency { @Override public String getIdentifier() { return "test2"; diff --git a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestPlugin.java b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestPlugin.java index 212bea6..f98d847 100644 --- a/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestPlugin.java +++ b/bukkittest/src/main/java/dev/xhyrom/lighteco/bukkittest/TestPlugin.java @@ -18,9 +18,7 @@ public class TestPlugin extends JavaPlugin { getLogger().info("TestCurrency registered!"); - currencyManager.getRegisteredCurrencies().forEach(currency -> { - getLogger().info("Currency: " + currency.getIdentifier() + " (" + currency.getType() + ", " + currency.fractionalDigits() + ", " + currency.isPayable() + ")"); - }); + currencyManager.getRegisteredCurrencies().forEach(currency -> getLogger().info("Currency: " + currency.getIdentifier() + " (" + currency.getType() + ", " + currency.fractionalDigits() + ", " + currency.isPayable() + ")")); provider.getCommandManager().registerCurrencyCommand(currencyManager.getCurrency("test")); provider.getCommandManager().registerCurrencyCommand(currencyManager.getCurrency("test2")); diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCurrencyManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCurrencyManager.java index 4a9b48b..4f19d76 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCurrencyManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiCurrencyManager.java @@ -23,7 +23,7 @@ public class ApiCurrencyManager extends ApiAbstractManager getRegisteredCurrencies() { return this.handler.values() .stream().map(this::wrap) - .collect(Collectors.toList()); + .toList(); } @Override diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/AbstractCommandManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/AbstractCommandManager.java index fdc3ec2..f48cc80 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/AbstractCommandManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/manager/command/AbstractCommandManager.java @@ -21,7 +21,7 @@ public abstract class AbstractCommandManager implements CommandManager { private final Map config; private final ArrayList mustWait = new ArrayList<>(); - public AbstractCommandManager(LightEcoPlugin plugin) { + protected AbstractCommandManager(LightEcoPlugin plugin) { this.plugin = plugin; this.config = this.plugin.getConfig().messages.currency; } @@ -59,13 +59,13 @@ public abstract class AbstractCommandManager implements CommandManager { } private CurrencyMessageConfig getConfig(Currency currency) { - CurrencyMessageConfig config = this.config.get(currency.getIdentifier()); + CurrencyMessageConfig currencyMessageConfig = this.config.get(currency.getIdentifier()); - if (config == null) { + if (currencyMessageConfig == null) { return this.config.get("default"); } - return config; + return currencyMessageConfig; } @Override diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/manager/currency/StandardCurrencyManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/manager/currency/StandardCurrencyManager.java index 3110a07..2064c5d 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/manager/currency/StandardCurrencyManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/manager/currency/StandardCurrencyManager.java @@ -6,13 +6,9 @@ import dev.xhyrom.lighteco.common.model.user.User; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import org.checkerframework.checker.nullness.qual.NonNull; -import java.math.BigDecimal; -import java.math.BigInteger; import java.util.Collection; import java.util.List; -import static dev.xhyrom.lighteco.api.model.currency.Currency.Type; - public class StandardCurrencyManager extends AbstractManager implements CurrencyManager { private final LightEcoPlugin plugin; diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/model/chat/AbstractCommandSender.java b/common/src/main/java/dev/xhyrom/lighteco/common/model/chat/AbstractCommandSender.java index 23a3be7..b3f8cbd 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/model/chat/AbstractCommandSender.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/model/chat/AbstractCommandSender.java @@ -3,7 +3,7 @@ package dev.xhyrom.lighteco.common.model.chat; public abstract class AbstractCommandSender implements CommandSender { protected final T delegate; - public AbstractCommandSender(T delegate) { + protected AbstractCommandSender(T delegate) { this.delegate = delegate; } } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java b/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java index 3289995..9c813ad 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/plugin/AbstractLightEcoPlugin.java @@ -12,10 +12,8 @@ import eu.okaeri.configs.ConfigManager; import eu.okaeri.configs.yaml.snakeyaml.YamlSnakeYamlConfigurer; import lombok.Getter; -import java.io.File; - +@Getter public abstract class AbstractLightEcoPlugin implements LightEcoPlugin { - @Getter private DependencyManager dependencyManager; @Getter private Config config; @@ -27,7 +25,7 @@ public abstract class AbstractLightEcoPlugin implements LightEcoPlugin { public final void load() { this.dependencyManager = new DependencyManagerImpl(this); - this.config = ConfigManager.create(Config.class, (it) -> { + this.config = ConfigManager.create(Config.class, it -> { it.withConfigurer(new YamlSnakeYamlConfigurer()); it.withBindFile(this.getBootstrap().getDataDirectory().resolve("config.yml")); it.withRemoveOrphans(true); diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/Storage.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/Storage.java index ee817e0..d9c82e9 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/Storage.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/Storage.java @@ -24,8 +24,8 @@ public class Storage { try { return callable.call(); } catch (Exception e) { - if (e instanceof RuntimeException) { - throw (RuntimeException) e; + if (e instanceof RuntimeException r) { + throw r; } throw new CompletionException(e); @@ -38,8 +38,8 @@ public class Storage { try { runnable.run(); } catch (Exception e) { - if (e instanceof RuntimeException) { - throw (RuntimeException) e; + if (e instanceof RuntimeException r) { + throw r; } throw new CompletionException(e); diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/memory/MemoryStorageProvider.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/memory/MemoryStorageProvider.java index 617f5c5..3337af6 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/memory/MemoryStorageProvider.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/memory/MemoryStorageProvider.java @@ -10,7 +10,7 @@ import java.util.HashMap; import java.util.UUID; public class MemoryStorageProvider implements StorageProvider { - private final HashMap userDatabase = new HashMap<>(); + private HashMap userDatabase; private final LightEcoPlugin plugin; public MemoryStorageProvider(LightEcoPlugin plugin) { @@ -18,10 +18,14 @@ public class MemoryStorageProvider implements StorageProvider { } @Override - public void init() {} + public void init() { + userDatabase = new HashMap<>(); + } @Override - public void shutdown() {} + public void shutdown() { + userDatabase = null; + } @Override public @NonNull User loadUser(@NonNull UUID uniqueId, @Nullable String username) { diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStatements.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStatements.java index 00ac722..14bdb40 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStatements.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStatements.java @@ -48,9 +48,8 @@ public enum SqlStatements { case POSTGRESQL -> { return this.postgresql; } + default -> throw new IllegalArgumentException("Unknown implementation: " + implementationName); } - - throw new IllegalArgumentException("Unknown implementation: " + implementationName); } public static boolean mustDuplicateParameters(StorageType implementationName) { diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStorageProvider.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStorageProvider.java index 2f59c45..c2aedfd 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStorageProvider.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/SqlStorageProvider.java @@ -14,7 +14,6 @@ import java.io.InputStream; import java.math.BigDecimal; import java.sql.*; import java.util.List; -import java.util.Map; import java.util.UUID; import java.util.function.Function; diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/file/FileConnectionFactory.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/file/FileConnectionFactory.java index 81908ca..aa7db9c 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/file/FileConnectionFactory.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/file/FileConnectionFactory.java @@ -2,7 +2,6 @@ package dev.xhyrom.lighteco.common.storage.provider.sql.connection.file; import dev.xhyrom.lighteco.common.storage.provider.sql.connection.ConnectionFactory; -import java.io.File; import java.nio.file.Path; import java.sql.Connection; import java.sql.SQLException; @@ -12,7 +11,7 @@ abstract class FileConnectionFactory implements ConnectionFactory { private Connection connection; private final Path file; - public FileConnectionFactory(Path file) { + protected FileConnectionFactory(Path file) { this.file = file; } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/HikariConnectionFactory.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/HikariConnectionFactory.java index d480431..adc5b84 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/HikariConnectionFactory.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/HikariConnectionFactory.java @@ -17,7 +17,7 @@ public abstract class HikariConnectionFactory implements ConnectionFactory { private final StorageDataConfig configuration; private HikariDataSource hikari; - public HikariConnectionFactory(StorageDataConfig configuration) { + protected HikariConnectionFactory(StorageDataConfig configuration) { this.configuration = configuration; } diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/MariaDBConnectionFactory.java b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/MariaDBConnectionFactory.java index 37b8eaa..f951bd4 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/MariaDBConnectionFactory.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/storage/provider/sql/connection/hikari/MariaDBConnectionFactory.java @@ -3,8 +3,6 @@ package dev.xhyrom.lighteco.common.storage.provider.sql.connection.hikari; import dev.xhyrom.lighteco.common.config.storage.StorageDataConfig; import dev.xhyrom.lighteco.common.storage.StorageType; -import java.util.Map; - public class MariaDBConnectionFactory extends DriverBasedHikariConnectionFactory { public MariaDBConnectionFactory(StorageDataConfig configuration) { super(configuration); diff --git a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/hooks/vault/Vault.java b/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/hooks/vault/Vault.java index 6a9537f..f82f3c2 100644 --- a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/hooks/vault/Vault.java +++ b/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/hooks/vault/Vault.java @@ -227,7 +227,7 @@ public class Vault extends AbstractEconomy { private double bigDecimalToDouble(final BigDecimal value) { double amount = value.doubleValue(); - if (new BigDecimal(amount).compareTo(value) > 0) { + if (BigDecimal.valueOf(amount).compareTo(value) > 0) { amount = Math.nextAfter(amount, Double.NEGATIVE_INFINITY); } diff --git a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/listener/BukkitServiceListener.java b/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/listener/BukkitServiceListener.java deleted file mode 100644 index 1bd6dae..0000000 --- a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/bukkit/listener/BukkitServiceListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.xhyrom.lighteco.currency.money.bukkit.listener; - -import net.milkbowl.vault.economy.Economy; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.ServiceRegisterEvent; - -public class BukkitServiceListener implements Listener { - @EventHandler - public void onServiceRegister(ServiceRegisterEvent event) { - if (!(event.getProvider().getProvider() instanceof Economy)) return; - - - } -} diff --git a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/common/MoneyCurrency.java b/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/common/MoneyCurrency.java index 4c3db5a..2308faf 100644 --- a/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/common/MoneyCurrency.java +++ b/currency-money/src/main/java/dev/xhyrom/lighteco/currency/money/common/MoneyCurrency.java @@ -4,7 +4,7 @@ import dev.xhyrom.lighteco.api.model.currency.Currency; import java.math.BigDecimal; -public class MoneyCurrency extends Currency { +public class MoneyCurrency implements Currency { @Override public String getIdentifier() { return "money"; diff --git a/gradlew b/gradlew old mode 100644 new mode 100755