Added autoPause config for servers (#7405)

* Extracted the method ServerControl.setPauseState()

* Added a comment to EventType.PlayerLeave

* Added the `pauseWithoutPlayers` config

* Revert "Extracted the method ServerControl.setPauseState()"

This reverts commit 45f5b01547.

* Renamed pauseWithoutPlayers to autoPause,
fixed manual- and automatic pausing to interfere
and made the server pause when hosting a new game

* Added a dot to the config description of `autoPause` and added my name to the contributors list

* Refactoring

* Merged remote-tracking changed I guess

* More refactoring

* More refactoring

* Removed logging about autoPause

* Removed another log I forgot in the last commit

Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
zenonet
2022-08-21 16:32:58 +02:00
committed by GitHub
parent 62a3f30755
commit dde9f895cf
4 changed files with 28 additions and 1 deletions

View File

@@ -554,6 +554,7 @@ public class EventType{
}
}
/** Called before a player leaves the game. */
public static class PlayerLeave{
public final Player player;

View File

@@ -487,7 +487,8 @@ public class Administration{
autosaveAmount = new Config("autosaveAmount", "The maximum amount of autosaves. Older ones get replaced.", 10),
autosaveSpacing = new Config("autosaveSpacing", "Spacing between autosaves in seconds.", 60 * 5),
debug = new Config("debug", "Enable debug logging", false, () -> Log.level = debug() ? LogLevel.debug : LogLevel.info),
snapshotInterval = new Config("snapshotInterval", "Client entity snapshot interval in ms.", 200);
snapshotInterval = new Config("snapshotInterval", "Client entity snapshot interval in ms.", 200),
autoPause = new Config("autoPause", "Whether the game should pause when nobody is online.", false);
public final Object defaultValue;
public final String name, key, description;