ServerControl was broken, yet again (#10661)

This commit is contained in:
WMF 2025-04-15 21:42:45 +02:00 committed by GitHub
parent 666c68edb1
commit 39834f21db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -248,6 +248,21 @@ public class ServerControl implements ApplicationListener{
}
}
}
if(state.isGame()){ //run this only if the server's actually hosting
if(Config.autoPause.bool()){
if(Groups.player.isEmpty()){
autoPaused = true;
state.set(State.paused);
}else if(autoPaused){
autoPaused = false;
state.set(State.playing);
}
}else if(autoPaused && Vars.state.isPaused()){ //unpause when the config is disabled
state.set(State.playing);
autoPaused = false;
}
}
});
Events.run(Trigger.socketConfigChanged, () -> {
@ -259,21 +274,6 @@ public class ServerControl implements ApplicationListener{
autoPaused = false;
});
Events.run(Trigger.update, () -> {
if(Config.autoPause.bool()){
if(Groups.player.isEmpty()){
autoPaused = true;
state.set(State.paused);
}else if(autoPaused){
autoPaused = false;
state.set(State.playing);
}
}else if(autoPaused && Vars.state.isPaused()){ //unpause when the config is disabled
state.set(State.playing);
autoPaused = false;
}
});
Events.on(PlayEvent.class, e -> {
try{
JsonValue value = JsonIO.json.fromJson(null, Core.settings.getString("globalrules"));