From 2fc19bc92d1d67e766020ed3a4ed76e960edc613 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 21 Jun 2021 22:02:53 +0200 Subject: [PATCH 1/2] Add Node3 --- src/de/steamwar/bungeecore/SubserverSystem.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index d002d2c3..e35a134e 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -239,7 +239,8 @@ public class SubserverSystem { List cmd = new ArrayList<>(); boolean jdk11 = serverJar.contains("1.15.2"); - if(!steamwarStartAvailable() && lixfelStartAvailable()){ + boolean notSteamwarStart = !steamwarStartAvailable(); + if (notSteamwarStart && remoteStartAvailable("lx")) { cmd.add("ssh"); cmd.add("-L"); cmd.add(port + ":localhost:" + port); @@ -247,6 +248,14 @@ public class SubserverSystem { cmd.add("cd"); cmd.add(directory.getPath()); cmd.add(";"); + } else if (notSteamwarStart && remoteStartAvailable("az")) { + cmd.add("ssh"); + cmd.add("-L"); + cmd.add(port + ":localhost:" + port); + cmd.add("az"); + cmd.add("cd"); + cmd.add(directory.getPath()); + cmd.add(";"); } if(jdk11) @@ -278,8 +287,8 @@ public class SubserverSystem { return LoadEvaluation.getCPULoad() < 0.8 && LoadEvaluation.getRamPercentage() < 0.8; } - private static boolean lixfelStartAvailable(){ - return LoadEvaluation.getRemoteCPULoad("lx") < 0.8 && LoadEvaluation.getRemoteRamPercentage("lx") < 0.8; + private static boolean remoteStartAvailable(String remote) { + return LoadEvaluation.getRemoteCPULoad(remote) < 0.8 && LoadEvaluation.getRemoteRamPercentage(remote) < 0.8; } private static boolean bauRunning(ProxiedPlayer p, UUID owner){ From ed10fbd786b481c958050752f1fa0d0fbdb4ca88 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 21 Jun 2021 22:07:38 +0200 Subject: [PATCH 2/2] Add Node3 --- .../steamwar/bungeecore/SubserverSystem.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index e35a134e..b44b331f 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -239,24 +239,25 @@ public class SubserverSystem { List cmd = new ArrayList<>(); boolean jdk11 = serverJar.contains("1.15.2"); - boolean notSteamwarStart = !steamwarStartAvailable(); - if (notSteamwarStart && remoteStartAvailable("lx")) { + boolean fallback = false; + if (!steamwarStartAvailable()) { cmd.add("ssh"); cmd.add("-L"); cmd.add(port + ":localhost:" + port); - cmd.add("lx"); - cmd.add("cd"); - cmd.add(directory.getPath()); - cmd.add(";"); - } else if (notSteamwarStart && remoteStartAvailable("az")) { - cmd.add("ssh"); - cmd.add("-L"); - cmd.add(port + ":localhost:" + port); - cmd.add("az"); + if (remoteStartAvailable("lx")) { + cmd.add("lx"); + } else if (remoteStartAvailable("az")) { + cmd.add("az"); + } else { + fallback = true; + } cmd.add("cd"); cmd.add(directory.getPath()); cmd.add(";"); } + if (fallback) { + cmd.clear(); + } if(jdk11) cmd.add("/usr/lib/jvm/java-11-openjdk-amd64/bin/java");