fix: 修复配置文件加载错误的问题
All checks were successful
Release Project / build (push) Successful in 5m11s

This commit is contained in:
2025-12-24 23:06:23 +08:00
parent 9b21e1a9b9
commit 4afa0756e8
2 changed files with 8 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
group = "cn.hamster3.server.mixin"
version = "1.0.0"
version = "1.0.1"
description = "为 Velocity 添加网易认证注入"
base {

View File

@@ -8,7 +8,7 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.util.Map;
public class NeteaseServerConfig {
public final class NeteaseServerConfig {
private static boolean loaded = false;
private static String authUrl = "http://192.168.0.100:9999/check";
private static String gameId = "12345678901234567";
@@ -17,6 +17,9 @@ public class NeteaseServerConfig {
init();
}
private NeteaseServerConfig() {
}
@SuppressWarnings("CallToPrintStackTrace")
public static void init() {
if (loaded) {
@@ -35,9 +38,9 @@ public class NeteaseServerConfig {
}
try {
String readString = Files.readString(file.toPath());
Map<String, String> map = new Yaml().load(readString);
authUrl = map.getOrDefault("auth-url", "http://192.168.0.100:9999/check");
gameId = map.getOrDefault("game-id", "12345678901234567");
Map<String, Object> map = new Yaml().load(readString);
authUrl = map.getOrDefault("auth-url", "http://192.168.0.100:9999/check").toString();
gameId = map.getOrDefault("game-id", "12345678901234567").toString();
} catch (IOException e) {
e.printStackTrace();
}