mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-09 17:18:05 +01:00
refactor: code cleanup
This commit is contained in:
parent
4d192eefd5
commit
a2be61eb95
5 changed files with 10 additions and 14 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
|
@ -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<dev.xhyrom.lighteco.commo
|
|||
}
|
||||
|
||||
@Override
|
||||
public @NonNull CompletableFuture<Void> saveUsers(@NotNull @NonNull User... users) {
|
||||
public @NonNull CompletableFuture<Void> saveUsers(@NonNull User... users) {
|
||||
return this.plugin.getStorage().saveUsers(users);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue