perf: 简化代码
This commit is contained in:
@@ -12,6 +12,10 @@ dependencies {
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "com.google.code.gson")
|
||||
}
|
||||
compileOnlyApi("net.kyori:adventure-text-serializer-legacy:4.13.1") {
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "com.google.code.gson")
|
||||
}
|
||||
|
||||
// https://mvnrepository.com/artifact/redis.clients/jedis
|
||||
compileOnlyApi("redis.clients:jedis:5.1.2") {
|
||||
|
@@ -29,7 +29,7 @@ public abstract class CoreAPI {
|
||||
@NotNull
|
||||
private final JedisPool jedisPool;
|
||||
/**
|
||||
* HamsterCore 公用数据库连接池
|
||||
* 公用数据库连接池
|
||||
*/
|
||||
@Getter
|
||||
@NotNull
|
||||
@@ -63,7 +63,7 @@ public abstract class CoreAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 HamsterCore 公用数据库连接池
|
||||
* 获取公用数据库连接池
|
||||
*
|
||||
* @return 公用数据库连接池
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ public abstract class CoreAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 HamsterCore 公用数据库连接
|
||||
* 获取公用数据库连接
|
||||
*
|
||||
* @return 公用数据库连接
|
||||
* @throws SQLException -
|
||||
|
@@ -7,7 +7,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -32,15 +32,12 @@ public final class UpdateCheckUtils {
|
||||
}
|
||||
|
||||
public static void checkUpdate(@NotNull String pluginName, @NotNull ConfigSection updateConfig, @NotNull Audience sender) throws IOException {
|
||||
String version = updateConfig.getString("version");
|
||||
if (version == null) {
|
||||
return;
|
||||
}
|
||||
String version = updateConfig.getString("version", "");
|
||||
String checkType = updateConfig.getString("CHECK_TYPE", "");
|
||||
String baseUrl = updateConfig.getString("GIT_BASE_URL");
|
||||
String gitRepo = updateConfig.getString("GIT_REPO");
|
||||
String downloadUrl = updateConfig.getString("DOWNLOAD_URL");
|
||||
if (baseUrl == null || gitRepo == null || downloadUrl == null) {
|
||||
if (baseUrl == null || gitRepo == null) {
|
||||
return;
|
||||
}
|
||||
String gitToken = updateConfig.getString("GIT_TOKEN");
|
||||
@@ -65,8 +62,12 @@ public final class UpdateCheckUtils {
|
||||
if (compareVersion(lastRelease, version) <= 0) {
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(Component.text(String.format("§a插件 §l%s§a 发布了新版本 %s", pluginName, lastRelease)));
|
||||
sender.sendMessage(Component.text(String.format("§b下载链接: §n%s", downloadUrl)));
|
||||
sender.sendMessage(LegacyComponentSerializer.legacySection().deserialize(
|
||||
String.format("§a插件 §l%s§a 发布了新版本 %s", pluginName, lastRelease)
|
||||
));
|
||||
if (downloadUrl != null) {
|
||||
sender.sendMessage(LegacyComponentSerializer.legacySection().deserialize("§b下载链接: §n" + downloadUrl));
|
||||
}
|
||||
}
|
||||
|
||||
public static int compareVersion(@NotNull String version1, String version2) {
|
||||
|
Reference in New Issue
Block a user