From a2be61eb95a91f16ac96396f122473fb82edcee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl=20=28xHyroM=29?= Date: Mon, 16 Oct 2023 17:47:46 +0200 Subject: [PATCH] refactor: code cleanup --- .../bukkit/hooks/PlaceholderAPIExpansion.java | 13 ++++++------- common/build.gradle.kts | 2 +- .../lighteco/common/api/impl/ApiUserManager.java | 3 +-- .../provider/memory/MemoryStorageProvider.java | 3 +-- .../storage/provider/sql/SqlStorageProvider.java | 3 +-- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java index a4162ad..b0bbb01 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java @@ -6,31 +6,30 @@ import dev.xhyrom.lighteco.common.model.user.User; import lombok.RequiredArgsConstructor; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; @RequiredArgsConstructor public class PlaceholderAPIExpansion extends PlaceholderExpansion { private final BukkitLightEcoPlugin plugin; @Override - public @NotNull String getIdentifier() { + public @NonNull String getIdentifier() { return "lighteco"; } @Override - public @NotNull String getAuthor() { + public @NonNull String getAuthor() { return this.plugin.getBootstrap().getLoader().getDescription().getAuthors().toString(); } @Override - public @NotNull String getVersion() { + public @NonNull String getVersion() { return this.plugin.getBootstrap().getLoader().getDescription().getVersion(); } @Override - public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) { + public @Nullable String onRequest(OfflinePlayer player, @NonNull String params) { String[] args = params.split("_"); if (args.length < 2) return null; diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 91998ab..049f144 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -4,6 +4,7 @@ plugins { dependencies { api(project(":lighteco-api")) + api("org.checkerframework:checker-qual:3.8.0") api("net.kyori:adventure-api:4.12.0") { exclude(module = "adventure-bom") exclude(module = "checker-qual") @@ -23,6 +24,5 @@ dependencies { compileOnly("org.projectlombok:lombok:1.18.28") annotationProcessor("org.projectlombok:lombok:1.18.28") - compileOnly("org.checkerframework:checker-qual:3.8.0") compileOnly("org.jetbrains:annotations:20.1.0") } \ No newline at end of file diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiUserManager.java b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiUserManager.java index 89098d2..c65d882 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiUserManager.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/api/impl/ApiUserManager.java @@ -5,7 +5,6 @@ import dev.xhyrom.lighteco.api.model.user.User; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -37,7 +36,7 @@ public class ApiUserManager extends ApiAbstractManager saveUsers(@NotNull @NonNull User... users) { + public @NonNull CompletableFuture saveUsers(@NonNull User... users) { return this.plugin.getStorage().saveUsers(users); } 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 bdea3e5..0658bf1 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 @@ -5,7 +5,6 @@ import dev.xhyrom.lighteco.api.storage.StorageProvider; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.UUID; @@ -43,7 +42,7 @@ public class MemoryStorageProvider implements StorageProvider { } @Override - public void saveUsers(@NotNull @NonNull User... users) { + public void saveUsers(@NonNull User... users) { for (User user : users) { this.userDatabase.put(user.getUniqueId(), user); } 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 afc900d..1240330 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 @@ -8,7 +8,6 @@ import dev.xhyrom.lighteco.common.storage.StorageType; import dev.xhyrom.lighteco.common.storage.provider.sql.connection.ConnectionFactory; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.jetbrains.annotations.NotNull; import java.math.BigDecimal; import java.sql.Connection; @@ -163,7 +162,7 @@ public class SqlStorageProvider implements StorageProvider { } @Override - public void saveUsers(@NotNull @NonNull User... users) throws Exception { + public void saveUsers(@NonNull User... users) throws Exception { // use transaction try (Connection c = this.connectionFactory.getConnection()) { try {