2 Commits

Author SHA1 Message Date
00dbcba628 fix(ball-common): 提前对服务器 id 和 name 进行空判断 2025-01-26 15:01:15 +08:00
2a4a3e9065 perf: 优化消息缓存表格 2024-11-09 22:30:51 +08:00
4 changed files with 13 additions and 4 deletions

View File

@@ -140,7 +140,10 @@ public abstract class BallAPI {
") CHARSET utf8mb4;");
statement.execute("CREATE TABLE IF NOT EXISTS `hamster_ball_cached_message`(" +
"`uuid` CHAR(36) NOT NULL," +
"`message` TEXT NOT NULL" +
"`message` TEXT NOT NULL," +
"`time` DATETIME NOT NULL DEFAULT NOW()," +
"INDEX `idx_uuid` USING BTREE (`uuid`)," +
"INDEX `idx_time` USING BTREE (`time`)" +
") CHARSET utf8mb4;");
}
if (getBallConfig().isGameServerUpdatePlayerInfo()) {
@@ -329,7 +332,7 @@ public abstract class BallAPI {
}
try (Connection connection = getDatasource().getConnection()) {
try (PreparedStatement statement = connection.prepareStatement(
"INSERT INTO `hamster_ball_cached_message` VALUES(?, ?);"
"INSERT INTO `hamster_ball_cached_message` VALUES(?, ?, DEFAULT);"
)) {
statement.setString(1, receiver.toString());
statement.setString(2, message.toJson().toString());

View File

@@ -46,7 +46,13 @@ public class BallServerInfo {
public BallServerInfo(@NotNull ConfigSection config, @NotNull BallServerType type) {
Map<String, String> 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;

View File

@@ -5,7 +5,7 @@ plugins {
}
group = "cn.hamster3.mc.plugin"
version = "1.7.0"
version = "1.7.2"
description = "基于 Redis 的 Minecraft 服务端通用消息中间件"
subprojects {

View File

@@ -1,6 +1,6 @@
#Sun Aug 20 16:53:32 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists