diff --git a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/entity/BallServerInfo.java b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/entity/BallServerInfo.java index 5c9899a..c15fe4b 100644 --- a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/entity/BallServerInfo.java +++ b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/entity/BallServerInfo.java @@ -46,7 +46,13 @@ public class BallServerInfo { public BallServerInfo(@NotNull ConfigSection config, @NotNull BallServerType type) { Map env = System.getenv(); id = env.getOrDefault("BALL_SERVER_ID", config.getString("id")); + if (id == null || id.isEmpty()) { + throw new IllegalArgumentException("id 不能为空"); + } name = env.getOrDefault("BALL_SERVER_NAME", config.getString("name")); + if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("name 不能为空"); + } this.type = type; host = "0.0.0.0"; port = 0; diff --git a/build.gradle.kts b/build.gradle.kts index 0452be6..42117ef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "cn.hamster3.mc.plugin" -version = "1.7.1" +version = "1.7.2" description = "基于 Redis 的 Minecraft 服务端通用消息中间件" subprojects {