Improve java version check (#9692)
This commit is contained in:
parent
99b311de54
commit
83cfeb1b37
5 changed files with 53 additions and 27 deletions
|
@ -16837,7 +16837,7 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index af70ccbc3142aa63ef4bfefe27c6328a29d1770e..d8a4db5024fbe5a1240f53e515ceb7066f834972 100644
|
||||
index af8afd53b5d3b34be4a5207316ce35abbcdf202d..017395b49d4cc0d12246332cc7d4d0113dcd5c5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -282,6 +282,7 @@ public class Main {
|
||||
|
|
47
patches/server/0348-Improve-java-version-check.patch
Normal file
47
patches/server/0348-Improve-java-version-check.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Wed, 16 Mar 2022 13:58:16 +0100
|
||||
Subject: [PATCH] Improve java version check
|
||||
|
||||
Co-Authored-By: MiniDigger <admin@benndorf.dev>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index c79afabed432ca9094967ae0e48b04133dc4c51b..2badebc0d7954c6d343bfd66dd14dc2d2d4661d7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -200,23 +200,27 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Paper start - better java version checks
|
||||
+ boolean skip = Boolean.getBoolean("Paper.IgnoreJavaVersion");
|
||||
float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
|
||||
- if (javaVersion < 61.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'.");
|
||||
- return;
|
||||
- }
|
||||
- if (javaVersion > 64.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 20 is supported.");
|
||||
+ boolean isOldVersion = javaVersion < 61.0;
|
||||
+ if (!skip && isOldVersion) {
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
return;
|
||||
}
|
||||
String javaVersionName = System.getProperty("java.version");
|
||||
// J2SE SDK/JRE Version String Naming Convention
|
||||
boolean isPreRelease = javaVersionName.contains("-");
|
||||
- if (isPreRelease && javaVersion == 61.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersionName + "). You are running an outdated, pre-release version. Only general availability versions of Java are supported. Please update your Java version.");
|
||||
+ if (!skip && isPreRelease) {
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersionName + "). You are running an unsupported, non official, version. Only general availability versions of Java are supported. Please update your Java version. See https://docs.papermc.io/paper/faq#unsupported-java-detected-what-do-i-do for more information.");
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (skip && (isOldVersion || isPreRelease)) {
|
||||
+ System.err.println("Unsupported Java detected ("+ javaVersionName + "), but the check was skipped. Proceed with caution! ");
|
||||
+ }
|
||||
+ // Paper end - better java version checks
|
||||
+
|
||||
try {
|
||||
// Paper start - Handled by TerminalConsoleAppender
|
||||
/*
|
|
@ -1,21 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Wed, 16 Mar 2022 13:58:16 +0100
|
||||
Subject: [PATCH] Remove garbage Java version check
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index c79afabed432ca9094967ae0e48b04133dc4c51b..77911e26af9ec468c8a0c1fe8161b79c67b2303c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -205,10 +205,6 @@ public class Main {
|
||||
System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'.");
|
||||
return;
|
||||
}
|
||||
- if (javaVersion > 64.0) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 20 is supported.");
|
||||
- return;
|
||||
- }
|
||||
String javaVersionName = System.getProperty("java.version");
|
||||
// J2SE SDK/JRE Version String Naming Convention
|
||||
boolean isPreRelease = javaVersionName.contains("-");
|
|
@ -283,7 +283,7 @@ index 5b8b345ade30012371bdda744ba82c585f74db07..0d100788312a234616c1401656f09835
|
|||
|
||||
// Paper start - Remove from collideRule team if needed
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb8941238bfa 100644
|
||||
index ffb691898d1c9c108be520dc8968214eacb425d5..a1f190cb17344f72e72c4205a011c08824c62cea 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@@ -152,6 +152,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
|
@ -319,7 +319,7 @@ index c3760f22fcc56ccb25e3315823054416c2172386..246606164117e8140ab0892ec1326503
|
|||
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 77911e26af9ec468c8a0c1fe8161b79c67b2303c..be1fbe64a5145b25c111ba3b6bb35109e77deb9d 100644
|
||||
index 09c13423e055ad414651a5cab43d10be4041e6f3..d91a839819e260e90f810968077c491060eafa22 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -178,6 +178,36 @@ public class Main {
|
||||
|
@ -359,7 +359,7 @@ index 77911e26af9ec468c8a0c1fe8161b79c67b2303c..be1fbe64a5145b25c111ba3b6bb35109
|
|||
try {
|
||||
options = parser.parse(args);
|
||||
} catch (joptsimple.OptionException ex) {
|
||||
@@ -280,8 +310,64 @@ public class Main {
|
||||
@@ -288,8 +318,64 @@ public class Main {
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Temp: Pre-init PlayerChunkLoaderData in order to prepopulate
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index bfa091f72d6f477bcaf63d364639a1b4df9b1987..776b7fc26fe96b69be260bbd36efae147d988640 100644
|
||||
index 300201c2bb64fff5df85f0d10d67e31536336f3a..d3d34bc806ccd4492cf19c42f8c3c7a4d2672576 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -359,6 +359,7 @@ public class Main {
|
||||
@@ -367,6 +367,7 @@ public class Main {
|
||||
tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.DummyLightLayerEventListener.class.getName());
|
||||
tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.class.getName());
|
||||
tryPreloadClass(net.minecraft.util.ExceptionCollector.class.getName());
|
||||
|
|
Loading…
Reference in a new issue