From 39834f21db38ec100859558f399672038ebbf2cb Mon Sep 17 00:00:00 2001 From: WMF <87574232+WMF-Industries@users.noreply.github.com> Date: Tue, 15 Apr 2025 21:42:45 +0200 Subject: [PATCH] ServerControl was broken, yet again (#10661) --- .../src/mindustry/server/ServerControl.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index 6c843b99b5..6dea071c9f 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -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"));