From 64365b42182ed204421c42277e9516792906a77e Mon Sep 17 00:00:00 2001 From: Riley Park Date: Mon, 17 May 2021 00:34:55 -0700 Subject: [PATCH] Add environment variable to disable server gui --- .../patches/sources/net/minecraft/server/Main.java.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/server/Main.java.patch b/paper-server/patches/sources/net/minecraft/server/Main.java.patch index 0df11be5c3..a4e6e66dcc 100644 --- a/paper-server/patches/sources/net/minecraft/server/Main.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/Main.java.patch @@ -205,7 +205,7 @@ worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen()); } -@@ -225,32 +296,44 @@ +@@ -225,32 +296,45 @@ return; } @@ -238,6 +238,7 @@ + */ + boolean flag2 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); ++ if(!Boolean.parseBoolean(System.getenv().getOrDefault("PAPER_DISABLE_SERVER_GUI", String.valueOf(false)))) // Paper - Add environment variable to disable server gui if (flag2 && !GraphicsEnvironment.isHeadless()) { dedicatedserver1.showGui(); } @@ -255,7 +256,7 @@ Thread thread = new Thread("Server Shutdown Thread") { public void run() { dedicatedserver.halt(true); -@@ -259,6 +342,7 @@ +@@ -259,6 +343,7 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -263,7 +264,7 @@ } catch (Exception exception1) { Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1); } -@@ -295,7 +379,7 @@ +@@ -295,7 +380,7 @@ } public static void forceUpgrade(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, boolean eraseCache, BooleanSupplier continueCheck, RegistryAccess dynamicRegistryManager, boolean recreateRegionFiles) {