refactor: 在初始化中订阅redis连接
This commit is contained in:
@@ -102,10 +102,10 @@ public abstract class BallAPI {
|
|||||||
getLogger().warning("已启用调试模式");
|
getLogger().warning("已启用调试模式");
|
||||||
eventBus.register(BallDebugListener.INSTANCE);
|
eventBus.register(BallDebugListener.INSTANCE);
|
||||||
}
|
}
|
||||||
|
CoreAPI.getInstance().getExecutorService().submit(() -> redisSub.subscribe(BallRedisListener.INSTANCE, BALL_CHANNEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void enable() throws SQLException, InterruptedException {
|
protected void enable() throws SQLException, InterruptedException {
|
||||||
CoreAPI.getInstance().getExecutorService().submit(() -> redisSub.subscribe(BallRedisListener.INSTANCE, BALL_CHANNEL));
|
|
||||||
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) {
|
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) {
|
||||||
String key = "HamsterBall:ServerInfo:" + localServerInfo.getId();
|
String key = "HamsterBall:ServerInfo:" + localServerInfo.getId();
|
||||||
if (jedis.exists(key)) {
|
if (jedis.exists(key)) {
|
||||||
|
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "cn.hamster3.mc.plugin"
|
group = "cn.hamster3.mc.plugin"
|
||||||
version = "1.6.4"
|
version = "1.6.5-SNAPSHOT"
|
||||||
description = "基于 Redis 的 Minecraft 服务端通用消息中间件"
|
description = "基于 Redis 的 Minecraft 服务端通用消息中间件"
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
Reference in New Issue
Block a user