Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-08-15 13:10:03 -04:00
4 changed files with 97 additions and 56 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;