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