Extracted the method ServerControl.setPauseState()

This commit is contained in:
zenonet 2022-08-19 19:56:17 +02:00
parent 166fcce13d
commit 45f5b01547

View file

@ -467,8 +467,7 @@ public class ServerControl implements ApplicationListener{
handler.register("pause", "<on/off>", "Pause or unpause the game.", arg -> {
boolean pause = arg[0].equals("on");
state.serverPaused = pause;
info(pause ? "Game paused." : "Game unpaused.");
setPauseState(pause);
});
handler.register("rules", "[remove/add] [name] [value...]", "List, remove or add global rules. These will apply regardless of map.", arg -> {
@ -973,6 +972,14 @@ public class ServerControl implements ApplicationListener{
mods.eachClass(p -> p.registerServerCommands(handler));
}
private static void setPauseState(boolean pause) {
if (pause == state.serverPaused)
return;
state.serverPaused = pause;
info(pause ? "Game paused." : "Game unpaused.");
}
public void handleCommandString(String line){
CommandResponse response = handler.handleMessage(line);