9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 19:49:06 +00:00

- Added JDK version check for an SFG

- Fixed duplicate cpu message on boot when on intel and unstable
This commit is contained in:
RePixelatedMC
2023-12-15 20:14:34 +01:00
parent 54ae026c2b
commit 1809d4a53f
3 changed files with 30 additions and 12 deletions

View File

@@ -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");
}

View File

@@ -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<String, Boolean> 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);

View File

@@ -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());
}
}
}
}