From 0ed8d26a66e30c51f959cccaddb2025ea8fb5a07 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 12 Apr 2021 09:15:24 +0200 Subject: [PATCH] Simplify serverStart with server name to start --- build.gradle | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 6a94ff7..b6d3387 100644 --- a/build.gradle +++ b/build.gradle @@ -98,11 +98,13 @@ if (project.hasProperty("hostname")) { group "Steamwar" doLast { - await(shell("scp ${libs}/${jarName} ${hostname}:~/Dev1.15/plugins")) - if (!answer("Start DEV server?")) { + def server = "Dev1.15" + // def server = "Developer" + await(shell("scp ${libs}/${jarName} ${hostname}:~/${server}/plugins")) + if (!answer("Start ${server} server?")) { return } - serverStart() + serverStart(server) } } } @@ -113,12 +115,6 @@ def await(Process proc) { proc.waitForProcessOutput(out, err) } -/** - * Executes a shell command and returns the stdout result. - * - * @param command the command to execute (cannot contain pipes) - * @return the trimmed result from stdout, stderr and the exit value - */ def shell(String command) { def proc if (operatingSystem == "unix") { @@ -129,11 +125,11 @@ def shell(String command) { return proc } -def serverStart() { - def proc = shell("ssh -t ${hostname} \"./mc Dev1.15\"") +def serverStart(String serverName) { + def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"") Thread outputThread = proc.consumeProcessOutputStream(System.out) - outputThread.setName("OutputThread") + outputThread.setName("${serverName} - OutputThread") Thread inputThread = new Thread(new Runnable() { @Override @@ -151,7 +147,7 @@ def serverStart() { } } }) - inputThread.setName("InputThread") + inputThread.setName("${serverName} - InputThread") inputThread.start() while (proc.alive) {