geforkt von Mirrors/Paper
Detect headless JREs (#8491)
Crashes caused by the missing AWT dependency come up in the support channels fairly often. This patch detects the missing dependency and stops the server with a clear error message, containing a link to instructions on how to install a non-headless JRE.
Dieser Commit ist enthalten in:
Ursprung
ddc8e1fd7c
Commit
95e37fca48
48
patches/server/Detect-headless-JREs.patch
Normale Datei
48
patches/server/Detect-headless-JREs.patch
Normale Datei
@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Noah van der Aa <ndvdaa@gmail.com>
|
||||
Date: Sat, 22 Oct 2022 14:47:45 +0200
|
||||
Subject: [PATCH] Detect headless JREs
|
||||
|
||||
Crashes caused by the missing AWT dependency come up in the support channels fairly often.
|
||||
This patch detects the missing dependency and stops the server with a clear error message,
|
||||
containing a link to instructions on how to install a non-headless JRE.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/ServerEnvironment.java b/src/main/java/io/papermc/paper/util/ServerEnvironment.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/ServerEnvironment.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/ServerEnvironment.java
|
||||
@@ -0,0 +0,0 @@ public class ServerEnvironment {
|
||||
public static boolean userIsRootOrAdmin() {
|
||||
return RUNNING_AS_ROOT_OR_ADMIN;
|
||||
}
|
||||
+
|
||||
+ public static boolean isMissingAWTDependency() {
|
||||
+ try {
|
||||
+ new java.awt.Color(0);
|
||||
+ } catch (UnsatisfiedLinkError e) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Paper start - Warn on headless
|
||||
+ if (io.papermc.paper.util.ServerEnvironment.isMissingAWTDependency()) {
|
||||
+ Main.LOGGER.error("You are using a headless JRE distribution.");
|
||||
+ Main.LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
|
||||
+ Main.LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
org.spigotmc.SpigotConfig.disabledAdvancements = spigotConfiguration.getStringList("advancements.disabled"); // Paper - fix SPIGOT-5885, must be set early in init
|
||||
// Paper start - fix SPIGOT-5824
|
||||
File file;
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren