ServerControl improvements (#8928)

* Update ServerControl.java

* Update Administration.java

* Update Maps.java

* Update ServerControl.java

* Update ServerControl.java

* Update Administration.java

* Update ServerControl.java

* Update Maps.java
This commit is contained in:
Даркнесс#3729
2023-08-15 16:51:52 +03:00
committed by GitHub
parent 1d4084c387
commit 6566f1c554
3 changed files with 95 additions and 54 deletions

View File

@@ -44,7 +44,9 @@ public class Maps{
/** All maps stored in an ordered array. */
private Seq<Map> maps = new Seq<>();
private ShuffleMode shuffleMode = ShuffleMode.all;
private @Nullable MapProvider shuffler;
private @Nullable Map nextMapOverride;
private ObjectSet<Map> previewList = new ObjectSet<>();
@@ -61,8 +63,19 @@ public class Maps{
this.shuffler = provider;
}
/** Set the map that will override the next selected map. */
public void setNextMapOverride(Map nextMapOverride){
this.nextMapOverride = nextMapOverride;
}
/** @return the next map to shuffle to. May be null, in which case the server should be stopped. */
public @Nullable Map getNextMap(Gamemode mode, @Nullable Map previous){
if(nextMapOverride != null){
Map next = nextMapOverride;
nextMapOverride = null;
return next;
}
if(shuffler != null) return shuffler.next(mode, previous);
return shuffleMode.next(mode, previous);
}

View File

@@ -513,7 +513,9 @@ public class Administration{
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),
autoPause = new Config("autoPause", "Whether the game should pause when nobody is online.", false);
autoPause = new Config("autoPause", "Whether the game should pause when nobody is online.", false),
roundExtraTime = new Config("roundExtraTime", "Time before loading a new map after the gameover, in seconds.", 12),
maxLogLength = new Config("maxLogLength", "The Maximum log file size, in bytes.", 1024 * 1024 * 5);
public final Object defaultValue;
public final String name, key, description;