1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-11-21 14:31:09 +01:00

refactor: code cleanup

This commit is contained in:
Jozef Steinhübl 2023-10-16 17:47:46 +02:00
parent 4d192eefd5
commit a2be61eb95
No known key found for this signature in database
GPG key ID: E944BC293F5FF7E7
5 changed files with 10 additions and 14 deletions

View file

@ -6,31 +6,30 @@ import dev.xhyrom.lighteco.common.model.user.User;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Nullable;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PlaceholderAPIExpansion extends PlaceholderExpansion { public class PlaceholderAPIExpansion extends PlaceholderExpansion {
private final BukkitLightEcoPlugin plugin; private final BukkitLightEcoPlugin plugin;
@Override @Override
public @NotNull String getIdentifier() { public @NonNull String getIdentifier() {
return "lighteco"; return "lighteco";
} }
@Override @Override
public @NotNull String getAuthor() { public @NonNull String getAuthor() {
return this.plugin.getBootstrap().getLoader().getDescription().getAuthors().toString(); return this.plugin.getBootstrap().getLoader().getDescription().getAuthors().toString();
} }
@Override @Override
public @NotNull String getVersion() { public @NonNull String getVersion() {
return this.plugin.getBootstrap().getLoader().getDescription().getVersion(); return this.plugin.getBootstrap().getLoader().getDescription().getVersion();
} }
@Override @Override
public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) { public @Nullable String onRequest(OfflinePlayer player, @NonNull String params) {
String[] args = params.split("_"); String[] args = params.split("_");
if (args.length < 2) return null; if (args.length < 2) return null;

View file

@ -4,6 +4,7 @@ plugins {
dependencies { dependencies {
api(project(":lighteco-api")) api(project(":lighteco-api"))
api("org.checkerframework:checker-qual:3.8.0")
api("net.kyori:adventure-api:4.12.0") { api("net.kyori:adventure-api:4.12.0") {
exclude(module = "adventure-bom") exclude(module = "adventure-bom")
exclude(module = "checker-qual") exclude(module = "checker-qual")
@ -23,6 +24,5 @@ dependencies {
compileOnly("org.projectlombok:lombok:1.18.28") compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("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") compileOnly("org.jetbrains:annotations:20.1.0")
} }

View file

@ -5,7 +5,6 @@ import dev.xhyrom.lighteco.api.model.user.User;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -37,7 +36,7 @@ public class ApiUserManager extends ApiAbstractManager<dev.xhyrom.lighteco.commo
} }
@Override @Override
public @NonNull CompletableFuture<Void> saveUsers(@NotNull @NonNull User... users) { public @NonNull CompletableFuture<Void> saveUsers(@NonNull User... users) {
return this.plugin.getStorage().saveUsers(users); return this.plugin.getStorage().saveUsers(users);
} }

View file

@ -5,7 +5,6 @@ import dev.xhyrom.lighteco.api.storage.StorageProvider;
import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin; import dev.xhyrom.lighteco.common.plugin.LightEcoPlugin;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
@ -43,7 +42,7 @@ public class MemoryStorageProvider implements StorageProvider {
} }
@Override @Override
public void saveUsers(@NotNull @NonNull User... users) { public void saveUsers(@NonNull User... users) {
for (User user : users) { for (User user : users) {
this.userDatabase.put(user.getUniqueId(), user); this.userDatabase.put(user.getUniqueId(), user);
} }

View file

@ -8,7 +8,6 @@ import dev.xhyrom.lighteco.common.storage.StorageType;
import dev.xhyrom.lighteco.common.storage.provider.sql.connection.ConnectionFactory; import dev.xhyrom.lighteco.common.storage.provider.sql.connection.ConnectionFactory;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Connection; import java.sql.Connection;
@ -163,7 +162,7 @@ public class SqlStorageProvider implements StorageProvider {
} }
@Override @Override
public void saveUsers(@NotNull @NonNull User... users) throws Exception { public void saveUsers(@NonNull User... users) throws Exception {
// use transaction // use transaction
try (Connection c = this.connectionFactory.getConnection()) { try (Connection c = this.connectionFactory.getConnection()) {
try { try {