perf: 清理无效代码
This commit is contained in:
@@ -3,21 +3,13 @@
|
|||||||
evaluationDependsOn(":core-common")
|
evaluationDependsOn(":core-common")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":core-common")) {
|
implementation(project(":core-common")) { isTransitive = false }
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
||||||
|
|
||||||
implementation("de.tr7zw:item-nbt-api:2.12.3-SNAPSHOT")
|
implementation("de.tr7zw:item-nbt-api:2.12.3-SNAPSHOT")
|
||||||
compileOnly("net.milkbowl.vault:VaultAPI:1.7") {
|
compileOnly("net.milkbowl.vault:VaultAPI:1.7") { isTransitive = false }
|
||||||
isTransitive = false
|
compileOnly("org.black_ixx:playerpoints:3.2.6") { isTransitive = false }
|
||||||
}
|
compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false }
|
||||||
compileOnly("org.black_ixx:playerpoints:3.2.6") {
|
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
compileOnly("me.clip:placeholderapi:2.11.5") {
|
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
|
|
||||||
implementation("net.kyori:adventure-platform-bukkit:4.3.2") {
|
implementation("net.kyori:adventure-platform-bukkit:4.3.2") {
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
@@ -27,18 +19,14 @@ dependencies {
|
|||||||
exclude(module = "adventure-api")
|
exclude(module = "adventure-api")
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
}
|
}
|
||||||
implementation("com.zaxxer:HikariCP:4.0.3") {
|
implementation("com.zaxxer:HikariCP:4.0.3") { exclude(group = "org.slf4j") }
|
||||||
exclude(group = "org.slf4j")
|
|
||||||
}
|
|
||||||
// https://mvnrepository.com/artifact/redis.clients/jedis
|
// https://mvnrepository.com/artifact/redis.clients/jedis
|
||||||
implementation("redis.clients:jedis:5.1.2") {
|
implementation("redis.clients:jedis:5.1.2") {
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
exclude(group = "org.slf4j")
|
exclude(group = "org.slf4j")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
|
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
|
||||||
implementation("org.quartz-scheduler:quartz:2.3.2") {
|
implementation("org.quartz-scheduler:quartz:2.3.2") { isTransitive = false }
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
@@ -13,19 +13,10 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public abstract class ParentCommand extends ChildCommand {
|
public abstract class ParentCommand extends ChildCommand {
|
||||||
@NotNull
|
|
||||||
private final String name;
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final List<ChildCommand> childCommands;
|
private final List<ChildCommand> childCommands;
|
||||||
|
|
||||||
public ParentCommand() {
|
public ParentCommand() {
|
||||||
name = "unset";
|
|
||||||
childCommands = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public ParentCommand(@NotNull String name) {
|
|
||||||
this.name = name;
|
|
||||||
childCommands = new ArrayList<>();
|
childCommands = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,9 +25,7 @@ public abstract class ParentCommand extends ChildCommand {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public abstract String getName();
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ParentCommand getParent() {
|
public ParentCommand getParent() {
|
||||||
@@ -79,14 +68,6 @@ public abstract class ParentCommand extends ChildCommand {
|
|||||||
plugin.getLogger().info("已注册指令 " + getUsage());
|
plugin.getLogger().info("已注册指令 " + getUsage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 建议使用 {@link #register()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void hook() {
|
|
||||||
register();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有子命令
|
* 获取所有子命令
|
||||||
* <p>
|
* <p>
|
||||||
|
@@ -367,7 +367,6 @@ public final class CoreBukkitUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static JsonObject serializePotionEffect(@NotNull PotionEffect effect) {
|
public static JsonObject serializePotionEffect(@NotNull PotionEffect effect) {
|
||||||
JsonObject object = new JsonObject();
|
JsonObject object = new JsonObject();
|
||||||
object.addProperty("type", effect.getType().getName());
|
object.addProperty("type", effect.getType().getName());
|
||||||
@@ -377,7 +376,6 @@ public final class CoreBukkitUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static PotionEffect deserializePotionEffect(@NotNull JsonObject object) {
|
public static PotionEffect deserializePotionEffect(@NotNull JsonObject object) {
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
return new PotionEffect(
|
return new PotionEffect(
|
||||||
|
@@ -3,9 +3,7 @@
|
|||||||
evaluationDependsOn(":core-common")
|
evaluationDependsOn(":core-common")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":core-common")) {
|
implementation(project(":core-common")) { isTransitive = false }
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
compileOnly("net.md-5:bungeecord-api:1.20-R0.1")
|
compileOnly("net.md-5:bungeecord-api:1.20-R0.1")
|
||||||
|
|
||||||
implementation("net.kyori:adventure-platform-bungeecord:4.3.2") {
|
implementation("net.kyori:adventure-platform-bungeecord:4.3.2") {
|
||||||
@@ -17,18 +15,14 @@ dependencies {
|
|||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation("com.zaxxer:HikariCP:4.0.3") {
|
implementation("com.zaxxer:HikariCP:4.0.3") { exclude(group = "org.slf4j") }
|
||||||
exclude(group = "org.slf4j")
|
|
||||||
}
|
|
||||||
// https://mvnrepository.com/artifact/redis.clients/jedis
|
// https://mvnrepository.com/artifact/redis.clients/jedis
|
||||||
implementation("redis.clients:jedis:5.1.2") {
|
implementation("redis.clients:jedis:5.1.2") {
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
exclude(group = "org.slf4j")
|
exclude(group = "org.slf4j")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
|
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz
|
||||||
implementation("org.quartz-scheduler:quartz:2.3.2") {
|
implementation("org.quartz-scheduler:quartz:2.3.2") { isTransitive = false }
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
@@ -5,9 +5,7 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
|
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
|
||||||
compileOnly("org.yaml:snakeyaml:1.19")
|
compileOnly("org.yaml:snakeyaml:1.19")
|
||||||
|
|
||||||
implementation("net.kyori:adventure-platform-api:4.3.2") {
|
implementation("net.kyori:adventure-platform-api:4.3.2") { exclude(group = "org.jetbrains") }
|
||||||
exclude(group = "org.jetbrains")
|
|
||||||
}
|
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:4.13.1") {
|
implementation("net.kyori:adventure-text-serializer-gson:4.13.1") {
|
||||||
exclude(group = "org.jetbrains")
|
exclude(group = "org.jetbrains")
|
||||||
exclude(group = "com.google.code.gson")
|
exclude(group = "com.google.code.gson")
|
||||||
|
@@ -8,7 +8,7 @@ import com.zaxxer.hikari.HikariDataSource;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.platform.AudienceProvider;
|
import net.kyori.adventure.platform.AudienceProvider;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPooled;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -27,7 +27,7 @@ public abstract class CoreAPI {
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@NotNull
|
@NotNull
|
||||||
private final JedisPool jedisPool;
|
private final JedisPooled jedisPool;
|
||||||
/**
|
/**
|
||||||
* HamsterCore 公用数据库连接池
|
* HamsterCore 公用数据库连接池
|
||||||
*/
|
*/
|
||||||
@@ -49,9 +49,9 @@ public abstract class CoreAPI {
|
|||||||
executorService = Executors.newCachedThreadPool(new NamedThreadFactory("HamsterCore - Executor"));
|
executorService = Executors.newCachedThreadPool(new NamedThreadFactory("HamsterCore - Executor"));
|
||||||
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
|
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
|
||||||
|
|
||||||
getLogger().info("正在创建 redis 客户端");
|
getLogger().info("正在创建 redis 连接池");
|
||||||
jedisPool = new JedisPool(config.getString("redis-url"));
|
jedisPool = new JedisPooled(config.getString("redis-url"));
|
||||||
getLogger().info("redis 客户端创建完成");
|
getLogger().info("redis 连接池创建完成");
|
||||||
|
|
||||||
ConfigSection datasourceConfig = config.getSection("datasource");
|
ConfigSection datasourceConfig = config.getSection("datasource");
|
||||||
if (datasourceConfig == null) {
|
if (datasourceConfig == null) {
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
package cn.hamster3.mc.plugin.core.common.util;
|
package cn.hamster3.mc.plugin.core.common.util;
|
||||||
|
|
||||||
import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.sound.Sound;
|
import net.kyori.adventure.sound.Sound;
|
||||||
@@ -13,34 +11,11 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class CoreUtils {
|
public final class CoreUtils {
|
||||||
/**
|
|
||||||
* @deprecated 使用 {@link CoreAPI#getGson()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Gson GSON = CoreAPI.getInstance().getGson();
|
|
||||||
/**
|
|
||||||
* @deprecated 使用 {@link CoreAPI#getHumanGson()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Gson GSON_HUMAN = CoreAPI.getInstance().getHumanGson();
|
|
||||||
/**
|
|
||||||
* @deprecated 使用 {@link CoreAPI#getExecutorService()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static ExecutorService WORKER_EXECUTOR = CoreAPI.getInstance().getExecutorService();
|
|
||||||
/**
|
|
||||||
* @deprecated 使用 {@link CoreAPI#getScheduledService()}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static ScheduledExecutorService SCHEDULED_EXECUTOR = CoreAPI.getInstance().getScheduledService();
|
|
||||||
|
|
||||||
private CoreUtils() {
|
private CoreUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
package cn.hamster3.mc.plugin.core.common.util;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Deprecated
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class Pair<K, V> implements Serializable {
|
|
||||||
private final K key;
|
|
||||||
private final V value;
|
|
||||||
|
|
||||||
public Pair(K key, V value) {
|
|
||||||
this.key = key;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
Pair<?, ?> pair = (Pair<?, ?>) o;
|
|
||||||
return Objects.equals(key, pair.key) && Objects.equals(value, pair.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Reference in New Issue
Block a user