From 00dbcba6280b4f2d5434a44416315543c69f32d7 Mon Sep 17 00:00:00 2001 From: MiniDay <372403923@qq.com> Date: Sun, 26 Jan 2025 15:01:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(ball-common):=20=E6=8F=90=E5=89=8D=E5=AF=B9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=20id=20=E5=92=8C=20name=20=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mc/plugin/ball/common/entity/BallServerInfo.java | 6 ++++++ build.gradle.kts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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 {