From 7526870ca1aea69b0d5044a60d5ee1614e62c115 Mon Sep 17 00:00:00 2001 From: Osiris Team Date: Mon, 15 May 2023 10:50:57 +0200 Subject: [PATCH] 7.2.24 Added multiple default stop commands --- pom.xml | 2 +- .../java/com/osiris/autoplug/client/Server.java | 13 ++++++++++++- .../autoplug/client/configs/GeneralConfig.java | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 8062061d..9a9b5a34 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.osiris.autoplug.client autoplug-client - 7.2.23 + 7.2.24 jar AutoPlug-Client diff --git a/src/main/java/com/osiris/autoplug/client/Server.java b/src/main/java/com/osiris/autoplug/client/Server.java index 8d0f2058..57524bab 100644 --- a/src/main/java/com/osiris/autoplug/client/Server.java +++ b/src/main/java/com/osiris/autoplug/client/Server.java @@ -16,8 +16,11 @@ import com.osiris.autoplug.client.tasks.BeforeServerStartupTasks; import com.osiris.autoplug.client.utils.GD; import com.osiris.autoplug.client.utils.UtilsJar; +import com.osiris.autoplug.client.utils.UtilsLists; import com.osiris.autoplug.client.utils.UtilsString; import com.osiris.autoplug.client.utils.io.AsyncInputStream; +import com.osiris.dyml.SmartString; +import com.osiris.dyml.YamlSection; import com.osiris.dyml.exceptions.*; import com.osiris.jlib.logger.AL; import net.lingala.zip4j.ZipFile; @@ -160,7 +163,15 @@ public static void stop() throws IOException, InterruptedException, YamlWriterEx AL.info("Stopping server..."); if (isRunning()) { - submitCommand(new GeneralConfig().server_stop_command.asString()); + YamlSection stopCommand = new GeneralConfig().server_stop_command; + List values = stopCommand.getValues(); + if (values.isEmpty()) { + AL.warn("No stop command provided in " + new UtilsLists().toString(stopCommand.getKeys())); + return; + } + for (SmartString v : values) { + submitCommand(v.asString()); + } while (Server.isRunning()) Thread.sleep(1000); ASYNC_SERVER_IN = null; diff --git a/src/main/java/com/osiris/autoplug/client/configs/GeneralConfig.java b/src/main/java/com/osiris/autoplug/client/configs/GeneralConfig.java index 215903ca..23099afb 100644 --- a/src/main/java/com/osiris/autoplug/client/configs/GeneralConfig.java +++ b/src/main/java/com/osiris/autoplug/client/configs/GeneralConfig.java @@ -91,8 +91,9 @@ public GeneralConfig(boolean save) throws IOException, DuplicateKeyException, Ya server_start_command = put(name, "server", "start-command").setComments("The full command used to start your server.", "Like 'java -jar server.jar' for example, or './server.exe'.", "./ represents the working directory (where the AutoPlug was started from)."); - server_stop_command = put(name, "server", "stop-command").setDefValues("stop").setComments( - "AutoPlug uses this command to stop your server."); + server_stop_command = put(name, "server", "stop-command").setDefValues("stop", "shutdown", "end", "close", "finish", "terminate", "abort").setComments( + "AutoPlug uses this command to stop your server.", + "By default there are multiple provided to ensure the right one is also there for your server type."); // Convert old config stuff to new one: YamlSection oldJavaPath = get(name, "server", "java-path");