From 133e3359059cac6fd92c7c968ac7ac0e9b7a6c4c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 21 Aug 2021 13:53:41 +0200 Subject: [PATCH] Fixes a bug causing the software to be stuck in the Stopping Servers state Fixes the case where the software tries to stop servers while no servers are actually running. This also fixes #10 --- .../minecraftserverlauncher/server/ServerHandler.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerHandler.java b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerHandler.java index 4bf340c..87b61bf 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerHandler.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/server/ServerHandler.java @@ -60,10 +60,13 @@ public class ServerHandler { } stoppingServers = true; + int serversRunning = 0; + for (Collection collection : Main.getController().getCurrentProfile().getCollections()) { Server server = collection.getServer(); BufferedWriter writer = server.getWriter(); if (writer != null) { + serversRunning++; if (server.isProxy()) { writer.write("end\n"); } else { @@ -74,7 +77,10 @@ public class ServerHandler { server.setStopped(); } } - //TODO: Set stoppingServers to false if no servers are actually running + + if (serversRunning == 0) { + stoppingServers = false; + } } /**