mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Extracted the method ServerControl.setPauseState()
This commit is contained in:
parent
166fcce13d
commit
45f5b01547
1 changed files with 9 additions and 2 deletions
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue