From a978f4122a28db02b32605f751107a1c23e24f88 Mon Sep 17 00:00:00 2001 From: Jason <11360596+jpenilla@users.noreply.github.com> Date: Sun, 3 Oct 2021 17:12:04 -0500 Subject: [PATCH] Start console thread after PaperConfig & MinecraftServer.console are initialized (#6716) --- ...tab-completions-for-brigadier-comman.patch | 21 +++++++++++++++++++ ...s-to-convert-between-Component-and-B.patch | 4 ++-- .../0685-Add-Unix-domain-socket-support.patch | 6 +++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/patches/server/0649-Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/0649-Enhance-console-tab-completions-for-brigadier-comman.patch index b0c49ebde..b61512b8a 100644 --- a/patches/server/0649-Enhance-console-tab-completions-for-brigadier-comman.patch +++ b/patches/server/0649-Enhance-console-tab-completions-for-brigadier-comman.patch @@ -206,6 +206,27 @@ index 0000000000000000000000000000000000000000..f33e9376bd166ebdb3d9f8c7467cd923 + return builder.toAttributedString(); + } +} +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index 67afb97e6cb545d319202f3eca771015065089f6..0300390025c3f5461ef5f379c1710a58de164117 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -184,7 +184,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + + thread.setDaemon(true); + thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); +- thread.start(); ++ // thread.start(); // Paper - moved down + DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName()); + if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { + DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); +@@ -218,6 +218,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + DedicatedServer.LOGGER.error("Unable to load server configuration", e); + return false; + } ++ thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized + com.destroystokyo.paper.PaperConfig.registerCommands(); + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now + io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc. diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java index 14cd8ae69d9b25dc5edad4ff96ff4a9acb1f22cb..b3484487fa8baa4d1dd6c595586fb26a01a2153d 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java diff --git a/patches/server/0663-Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/0663-Implement-methods-to-convert-between-Component-and-B.patch index b4ddba8f8..20d49eb99 100644 --- a/patches/server/0663-Implement-methods-to-convert-between-Component-and-B.patch +++ b/patches/server/0663-Implement-methods-to-convert-between-Component-and-B.patch @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 67afb97e6cb545d319202f3eca771015065089f6..472d0635719c0a8f495ce474bd4a268d4e9071c8 100644 +index 0300390025c3f5461ef5f379c1710a58de164117..2d53dba26af9d372a507ca2d46dec0cb5b9e41b1 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -221,6 +221,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -222,6 +222,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc. diff --git a/patches/server/0685-Add-Unix-domain-socket-support.patch b/patches/server/0685-Add-Unix-domain-socket-support.patch index 0c58ff200..d9c7a6b29 100644 --- a/patches/server/0685-Add-Unix-domain-socket-support.patch +++ b/patches/server/0685-Add-Unix-domain-socket-support.patch @@ -27,10 +27,10 @@ index bdd4f4db9849d9107b5c62d5e83b1277621f49f1..9d09ec3b127e3440bef6b248578dec10 } // Spigot End diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 472d0635719c0a8f495ce474bd4a268d4e9071c8..1bf19965d12514dee34545235bfbadc0b74ddc8b 100644 +index 2d53dba26af9d372a507ca2d46dec0cb5b9e41b1..7ce1ce59eeba8b57cd76b1c9c561733b476e7ebf 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -232,6 +232,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -233,6 +233,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist); // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); @@ -51,7 +51,7 @@ index 472d0635719c0a8f495ce474bd4a268d4e9071c8..1bf19965d12514dee34545235bfbadc0 InetAddress inetaddress = null; if (!this.getLocalIp().isEmpty()) { -@@ -241,12 +255,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -242,12 +256,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (this.getPort() < 0) { this.setPort(dedicatedserverproperties.serverPort); }