Skip to content

Commit

Permalink
7.2.24
Browse files Browse the repository at this point in the history
Added multiple default stop commands
  • Loading branch information
Osiris-Team committed May 15, 2023
1 parent b9efe54 commit 7526870
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.osiris.autoplug.client</groupId>
<artifactId>autoplug-client</artifactId>
<version>7.2.23</version>
<version>7.2.24</version>
<packaging>jar</packaging>

<name>AutoPlug-Client</name>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/osiris/autoplug/client/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<SmartString> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 7526870

Please sign in to comment.