feat(ball-server): 添加重载指令

This commit is contained in:
2023-07-19 14:55:32 +08:00
parent e061d7ea4a
commit 437668ee13

View File

@@ -1,9 +1,11 @@
package cn.hamster3.mc.plugin.ball.server.command;
import cn.hamster3.mc.plugin.ball.server.config.ServerConfig;
import io.netty.channel.EventLoopGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Scanner;
public class CommandHandler {
@@ -38,6 +40,10 @@ public class CommandHandler {
help();
break;
}
case "reload": {
reload();
break;
}
case "end":
case "stop": {
stop();
@@ -53,10 +59,16 @@ public class CommandHandler {
public void help() {
LOGGER.info("===============================================================");
LOGGER.info("help - 查看帮助.");
LOGGER.info("reload - 重载配置文件.");
LOGGER.info("stop - 关闭该程序.");
LOGGER.info("===============================================================");
}
public void reload() throws IOException {
ServerConfig.init();
LOGGER.info("配置文件加载完成.");
}
public void stop() throws Exception {
started = false;
LOGGER.info("准备关闭服务器...");