From 4e6daaa8c061d7c06add9095a551eaa1907aff61 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 29 Jan 2022 13:56:24 +0100 Subject: [PATCH] Java 8 for 1.8 - 1.10 Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/Node.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/Node.java b/src/de/steamwar/bungeecore/Node.java index d53d2e8..bf4b3e9 100644 --- a/src/de/steamwar/bungeecore/Node.java +++ b/src/de/steamwar/bungeecore/Node.java @@ -22,10 +22,7 @@ package de.steamwar.bungeecore; import net.md_5.bungee.api.ProxyServer; import java.io.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.logging.Level; @@ -34,6 +31,14 @@ public abstract class Node { private static final List OPENJ9_ARGS = Arrays.asList("-Xgc:excessiveGCratio=80", "-Xsyslog:none", "-Xtrace:none", "-Xdisableexplicitgc", "-XX:+AlwaysPreTouch", "-XX:+CompactStrings", "-XX:-HeapDumpOnOutOfMemory", "-XX:+ExitOnOutOfMemoryError", "-Dlog4j.configurationFile=log4j2.xml"); private static final double MIN_FREE_MEM = 4.0 * 1024 * 1024; // 4 GiB + private static final Set JAVA_8 = new HashSet<>(); + static { + JAVA_8.add("paper-1.8.8.jar"); + JAVA_8.add("paper-1.10.2.jar"); + JAVA_8.add("spigot-1.8.8.jar"); + JAVA_8.add("spigot-1.9.4.jar"); + JAVA_8.add("spigot-1.10.2.jar"); + } private static final List nodes = new ArrayList<>(); public static Node local = null; @@ -74,7 +79,10 @@ public abstract class Node { public abstract double getLoad(); protected void constructServerstart(File directory, List cmd, String serverJar, String worldDir, String levelName, int port, String xmx, String... dParams) { - cmd.add("java"); + if (JAVA_8.contains(serverJar)) + cmd.add("/usr/lib/jvm/java-8-openj9-amd64/bin/java"); + else + cmd.add("java"); for(String param : dParams){ cmd.add("-D" + param); -- 2.39.2