diff --git a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/api/BallAPI.java b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/api/BallAPI.java index 70ef6c8..e571b64 100644 --- a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/api/BallAPI.java +++ b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/api/BallAPI.java @@ -70,7 +70,7 @@ public abstract class BallAPI { protected void enable() throws SQLException, InterruptedException { BallServerInfo localInfo = getLocalServerInfo(); - try (Connection connection = getDatasource().getConnection()) { + try (Connection connection = BallAPI.getInstance().getDatasource().getConnection()) { try (Statement statement = connection.createStatement()) { statement.execute("CREATE TABLE IF NOT EXISTS `hamster_ball_player_info`(" + "`uuid` CHAR(36) PRIMARY KEY," + @@ -143,7 +143,7 @@ public abstract class BallAPI { protected void disable() throws SQLException, InterruptedException { sendBallMessage(BALL_CHANNEL, new BallMessage(BallActions.ServerOffline.name(), new ServerOffline(getLocalServerInfo())), true); - try (Connection connection = getDatasource().getConnection()) { + try (Connection connection = BallAPI.getInstance().getDatasource().getConnection()) { try (PreparedStatement statement = connection.prepareStatement( "DELETE FROM `hamster_ball_server_info` WHERE `id`=?;" )) { @@ -288,7 +288,7 @@ public abstract class BallAPI { if (!cache) { return; } - try (Connection connection = getDatasource().getConnection()) { + try (Connection connection = BallAPI.getInstance().getDatasource().getConnection()) { try (PreparedStatement statement = connection.prepareStatement( "INSERT INTO `hamster_ball_cached_message` VALUES(?, ?);" )) { @@ -326,7 +326,7 @@ public abstract class BallAPI { if (info != null && info.isOnline()) { continue; } - try (Connection connection = getDatasource().getConnection()) { + try (Connection connection = BallAPI.getInstance().getDatasource().getConnection()) { try (PreparedStatement statement = connection.prepareStatement( "INSERT INTO `hamster_ball_cached_message` VALUES(?, ?);" )) { @@ -646,27 +646,27 @@ public abstract class BallAPI { @Override public void message(String pattern, String channel, BallMessage message) { - onMessage(channel, message); + } @Override public void subscribed(String channel, long count) { - getLogger().info("已订阅 redis 频道: " + channel); + } @Override public void psubscribed(String pattern, long count) { - getLogger().info("已订阅 redis 频道(正则): " + pattern); + } @Override public void unsubscribed(String channel, long count) { - getLogger().info("已取消订阅 redis 频道: " + channel); + } @Override public void punsubscribed(String pattern, long count) { - getLogger().info("已取消订阅 redis 频道(正则): " + pattern); + } } } diff --git a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/listener/BallDebugLogListener.java b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/listener/BallDebugLogListener.java index 0b5d8ae..843b35c 100644 --- a/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/listener/BallDebugLogListener.java +++ b/ball-common/src/main/java/cn/hamster3/mc/plugin/ball/common/listener/BallDebugLogListener.java @@ -22,17 +22,21 @@ public class BallDebugLogListener implements RedisPubSubListener