diff --git a/core/src/main/java/com/volmit/iris/Iris.java b/core/src/main/java/com/volmit/iris/Iris.java index 9aa60164e..274eb598e 100644 --- a/core/src/main/java/com/volmit/iris/Iris.java +++ b/core/src/main/java/com/volmit/iris/Iris.java @@ -350,7 +350,7 @@ public class Iris extends VolmitPlugin implements Listener { } } - private static int getJavaVersion() { + public static int getJavaVersion() { String version = System.getProperty("java.version"); if (version.startsWith("1.")) { version = version.substring(2, 3); @@ -787,18 +787,20 @@ public class Iris extends VolmitPlugin implements Listener { } Iris.info("Server OS: " + osName + " (" + osArch + ")"); - if(unstablemode) Iris.info("Server Cpu: " + C.DARK_RED + getCPUModel()); try { - if (getCPUModel().contains("Intel")) { - Iris.info("Server Cpu: " + C.BLUE + getCPUModel()); + if(unstablemode){ + Iris.info("Server Cpu: " + C.DARK_RED + getCPUModel()); + } else { + if (getCPUModel().contains("Intel")) { + Iris.info("Server Cpu: " + C.BLUE + getCPUModel()); + } + if (getCPUModel().contains("Ryzen")) { + Iris.info("Server Cpu: " + C.RED + getCPUModel()); + } + if (!getCPUModel().contains("Ryzen") && !getCPUModel().contains("Intel")) { + Iris.info("Server Cpu: " + C.GRAY + getCPUModel()); + } } - if (getCPUModel().contains("Ryzen")) { - Iris.info("Server Cpu: " + C.RED + getCPUModel()); - } - if (!getCPUModel().contains("Ryzen") && !getCPUModel().contains("Intel")) { - Iris.info("Server Cpu: " + C.GRAY + getCPUModel()); - } - } catch (Exception e){ Iris.info("Server Cpu: " + C.DARK_RED + "Failed"); } diff --git a/core/src/main/java/com/volmit/iris/core/safeguard/ServerBootSFG.java b/core/src/main/java/com/volmit/iris/core/safeguard/ServerBootSFG.java index 2e8f14786..02047f315 100644 --- a/core/src/main/java/com/volmit/iris/core/safeguard/ServerBootSFG.java +++ b/core/src/main/java/com/volmit/iris/core/safeguard/ServerBootSFG.java @@ -6,14 +6,17 @@ import com.volmit.iris.core.nms.v1X.NMSBinding1X; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; +import javax.tools.ToolProvider; import java.util.*; +import static com.volmit.iris.Iris.getJavaVersion; import static com.volmit.iris.Iris.instance; import static com.volmit.iris.core.safeguard.IrisSafeguard.stablemode; import static com.volmit.iris.core.safeguard.IrisSafeguard.unstablemode; public class ServerBootSFG { public static final Map incompatiblePlugins = new HashMap<>(); + public static boolean isJDK17 = true; public static boolean unsuportedversion = false; protected static boolean safeguardPassed; public static boolean passedserversoftware = true; @@ -67,6 +70,12 @@ public class ServerBootSFG { severityHigh++; } + boolean jdk = System.getProperty("java.compiler") != null; + if(getJavaVersion() != 17 || !jdk) { + isJDK17 = false; + severityMedium++; + } + allIncompatiblePlugins = joiner.toString(); safeguardPassed = (severityHigh == 0 && severityMedium == 0 && severityLow == 0); diff --git a/core/src/main/java/com/volmit/iris/core/safeguard/UtilsSFG.java b/core/src/main/java/com/volmit/iris/core/safeguard/UtilsSFG.java index b026f8f02..93be5617d 100644 --- a/core/src/main/java/com/volmit/iris/core/safeguard/UtilsSFG.java +++ b/core/src/main/java/com/volmit/iris/core/safeguard/UtilsSFG.java @@ -37,7 +37,14 @@ public class UtilsSFG { if (!ServerBootSFG.passedserversoftware) { Iris.safeguard(C.RED + "Unsupported Server Software"); Iris.safeguard(C.RED + "- Please consider using Paper or Purpur instead."); - + } + if (!ServerBootSFG.isJDK17) { + Iris.safeguard(C.YELLOW + "Unsupported Server JDK"); + if (Iris.getJavaVersion() == 17) { + Iris.safeguard(C.YELLOW + "- Please consider using JDK 17 Instead of JRE " + Iris.getJavaVersion()); + } else { + Iris.safeguard(C.YELLOW + "- Please consider using JDK 17 Instead of JDK " + Iris.getJavaVersion()); + } } } }