Extracted the method ServerControl.setPauseState()
This commit is contained in:
@@ -467,8 +467,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
handler.register("pause", "<on/off>", "Pause or unpause the game.", arg -> {
|
handler.register("pause", "<on/off>", "Pause or unpause the game.", arg -> {
|
||||||
boolean pause = arg[0].equals("on");
|
boolean pause = arg[0].equals("on");
|
||||||
state.serverPaused = pause;
|
setPauseState(pause);
|
||||||
info(pause ? "Game paused." : "Game unpaused.");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.register("rules", "[remove/add] [name] [value...]", "List, remove or add global rules. These will apply regardless of map.", arg -> {
|
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));
|
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){
|
public void handleCommandString(String line){
|
||||||
CommandResponse response = handler.handleMessage(line);
|
CommandResponse response = handler.handleMessage(line);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user