feat: 添加调试模式

This commit is contained in:
2022-10-29 08:14:22 +08:00
parent 43b9a6dc5b
commit 6a94fccb42
7 changed files with 162 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import cn.hamster3.mc.plugin.ball.common.api.BallAPI;
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.ball.common.listener.BallDebugListener;
import cn.hamster3.mc.plugin.core.bungee.HamsterBallPlugin;
import cn.hamster3.mc.plugin.core.bungee.listener.BallBungeeCordListener;
import cn.hamster3.mc.plugin.core.bungee.util.BungeeCordUtils;
@@ -11,6 +12,7 @@ import net.md_5.bungee.config.Configuration;
import org.jetbrains.annotations.NotNull;
import java.sql.SQLException;
import java.util.logging.Logger;
public class BallBungeeCordAPI extends BallAPI {
public BallBungeeCordAPI(@NotNull BallConfig config) {
@@ -40,7 +42,11 @@ public class BallBungeeCordAPI extends BallAPI {
pluginConfig.getInt("ball-server.nio-thread")
);
instance = new BallBungeeCordAPI(config);
instance.addListener(BallBungeeCordListener.INSTANCE);
if (pluginConfig.getBoolean("debug", false)) {
instance.addListener(BallDebugListener.INSTANCE);
}
}
@Override
@@ -52,4 +58,9 @@ public class BallBungeeCordAPI extends BallAPI {
public void disable() throws SQLException, InterruptedException {
super.disable();
}
@Override
public @NotNull Logger getLogger() {
return HamsterBallPlugin.getInstance().getLogger();
}
}

View File

@@ -1,3 +1,6 @@
# 是否允许在控制台输出调试信息
debug: false
ball-server:
host: "ball.hamster3.cn"
port: 58888