diff options
author | Spottedleaf <[email protected]> | 2024-07-17 10:24:53 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-07-17 10:28:32 -0700 |
commit | 00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6 (patch) | |
tree | 82639515bc5e9ae00c1e639e72137ed51e1ac688 /patches/server/0759-Detect-headless-JREs.patch | |
parent | 967f98aa81da851740aeb429778e46159fd188df (diff) | |
download | Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.tar.gz Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.zip |
Remove Moonrise utils to MCUtils, remove duplicated/unused utils
Diffstat (limited to 'patches/server/0759-Detect-headless-JREs.patch')
-rw-r--r-- | patches/server/0759-Detect-headless-JREs.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/server/0759-Detect-headless-JREs.patch b/patches/server/0759-Detect-headless-JREs.patch new file mode 100644 index 0000000000..5ba28913a8 --- /dev/null +++ b/patches/server/0759-Detect-headless-JREs.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Noah van der Aa <[email protected]> +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 68098dfe716e93aafcca4d8d5b5a81d8648b3654..2b7070e0cefa7cf0777df159693750fea14e800b 100644 +--- a/src/main/java/io/papermc/paper/util/ServerEnvironment.java ++++ b/src/main/java/io/papermc/paper/util/ServerEnvironment.java +@@ -20,4 +20,14 @@ public class ServerEnvironment { + public static boolean userIsRootOrAdmin() { + return RUNNING_AS_ROOT_OR_ADMIN; + } ++ ++ public static String awtDependencyCheck() { ++ try { ++ new java.awt.Color(0); ++ } catch (UnsatisfiedLinkError e) { ++ return e.getClass().getName() + ": " + e.getMessage(); ++ } ++ ++ return null; ++ } + } +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 467b8ca8007c5d3a7b72b88e3a979bdf09f1a283..13e1a914d4523f1c192db2a9a1ee6522e0ee27da 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -167,6 +167,18 @@ public class Main { + return; + } + ++ // Paper start - Detect headless JRE ++ String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck(); ++ if (awtException != null) { ++ 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"); ++ Main.LOGGER.error(""); ++ Main.LOGGER.error(awtException); ++ return; ++ } ++ // Paper end - Detect headless JRE ++ + 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; |