refactor: 将 lettuce 转至 HamsterCore 里

This commit is contained in:
2024-01-13 18:49:22 +08:00
parent 0566941e85
commit b7b7f89267
13 changed files with 47 additions and 93 deletions

View File

@@ -7,7 +7,6 @@ import cn.hamster3.mc.plugin.ball.common.config.BallConfig;
import cn.hamster3.mc.plugin.ball.common.entity.BallServerInfo;
import cn.hamster3.mc.plugin.ball.common.entity.BallServerType;
import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
import io.lettuce.core.RedisClient;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.jetbrains.annotations.NotNull;
@@ -58,7 +57,6 @@ public class BallBukkitAPI extends BallAPI {
BallConfig ballConfig = new BallConfig(
config.getBoolean("debug", false),
RedisClient.create(config.getString("redis-url")),
config.getString("channel-prefix", "") + ":",
config.getBoolean("game-server-update-player-info", false),
serverInfo,

View File

@@ -1,23 +1,19 @@
# 是否允许在控制台输出调试信息
debug: false
# redis 连接配置,连接格式如下:
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
# 若没有设置 redis 用户名,则可以省略,以下方法三选一:
# 使用默认用户名: redis://default:密码@localhost:6379?clientName=HamsterBall
# 不写用户名: redis://:密码@localhost:6379?clientName=HamsterBall
# 只写密码: redis://密码@localhost:6379?clientName=HamsterBall
# 若没有设置 redis 用户名和密码,则可以省略:
# redis://localhost:6379?clientName=HamsterBall
# 若不设置数据库,则默认使用 0
# 详细信息https://github.com/lettuce-io/lettuce-core/wiki/Redis-URI-and-connection-details
redis-url: "redis://localhost:6379?clientName=HamsterBall"
# 频道名前缀
# 使用这个配置选项可以划分子服消息通信分组
# 只有在同一个频道名的子服才能互相通信
channel-prefix: ""
# 是否在子服端更新玩家信息
# 默认情况下BC 统一管理玩家信息,包括记录 UUID 和玩家名称
# 如果一个群组服同时拥有多个 BC 入口
# 且每个 BC 入口为不同的玩家名称分配不同的 UUID
# (例如正版、盗版双入口,或网易多入口接同一个子服)
# 则可以启用该功能以防止 UUID 紊乱的问题
game-server-update-player-info: false
# 本服务器信息
server-info:
# 服务器唯一识别码,最长 32 字符
@@ -34,14 +30,6 @@ server-info:
# 不填则自动获取 server.properties 文件中的设置
# port: 25577
# 是否在子服端更新玩家信息
# 默认情况下BC 统一管理玩家信息,包括记录 UUID 和玩家名称
# 如果一个群组服同时拥有多个 BC 入口
# 且每个 BC 入口为不同的玩家名称分配不同的 UUID
# (例如正版、盗版双入口,或网易多入口接同一个子服)
# 则可以启用该功能以防止 UUID 紊乱的问题
game-server-update-player-info: false
# 数据库连接池配置
# 如果注释该选项则默认使用 HamsterCore 中的连接池配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接