build: 优化依赖

This commit is contained in:
2023-10-12 14:51:42 +08:00
parent 46997d6c17
commit b4eed3133b
9 changed files with 50 additions and 105 deletions

View File

@@ -4,29 +4,19 @@ dependencies {
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compileOnly("com.google.code.gson:gson:2.8.0")
val adventureVersion = property("adventure_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-api
implementation("net.kyori:adventure-platform-api:${adventureVersion}") {
exclude(group = "org.jetbrains")
}
val adventureSerializerVersion = property("adventure_serializer_version")
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation("net.kyori:adventure-text-minimessage:${adventureSerializerVersion}") {
api("net.kyori:adventure-platform-api:4+") {
exclude(group = "org.jetbrains")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation("net.kyori:adventure-text-serializer-gson:${adventureSerializerVersion}") {
api("net.kyori:adventure-text-serializer-gson:4.13+") {
exclude(group = "org.jetbrains")
exclude(group = "com.google.code.gson")
}
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation("net.kyori:adventure-text-serializer-legacy:${adventureSerializerVersion}") {
exclude(group = "org.jetbrains")
}
}
tasks {
withType<Jar>() {
withType<Jar> {
archiveBaseName = "HamsterCore-Common"
}
}

View File

@@ -1,6 +1,7 @@
package cn.hamster3.mc.plugin.core.common.api;
import com.google.gson.Gson;
import lombok.Getter;
import net.kyori.adventure.platform.AudienceProvider;
import org.jetbrains.annotations.NotNull;
@@ -12,12 +13,9 @@ import java.util.concurrent.ScheduledExecutorService;
@SuppressWarnings("unused")
public abstract class CoreAPI {
@Getter
protected static CoreAPI instance;
public static CoreAPI getInstance() {
return instance;
}
@NotNull
public abstract AudienceProvider getAudienceProvider();
@@ -32,20 +30,24 @@ public abstract class CoreAPI {
/**
* @return GSON 工具
*/
@NotNull
public abstract Gson getGson();
/**
* @return GSON 工具会使用格式化输出、且解析中包含null参数
*/
@NotNull
public abstract Gson getHumanGson();
/**
* @return 异步线程池
*/
@NotNull
public abstract ExecutorService getExecutorService();
/**
* @return 调度器线程池
*/
@NotNull
public abstract ScheduledExecutorService getScheduledExecutorService();
}