9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 04:46:38 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0004-Leaf-config.patch
Dreeam 69a59f9fac Init Leaf config eariler
Move Leaf config init before the CrashReport#preload to prevent some configurable values can't read properly in some class static fields

For example, the CrashReport#preload triggers the init of Util class. If the config init happens after this, then can't read config values for VT4ProfilerExecutor properly
2025-10-06 12:53:46 -04:00

48 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Wed, 12 Oct 2022 10:42:15 -0400
Subject: [PATCH] Leaf config
Leaf Config v3
including load config, backup old or outdated config, and add config to spark profiler automatically.
TODO - Dreeam:
Add per world config
Update config reload:
- Use different state to separate different configs reload
(Or sync reload)
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index b06c2c4aa77edafb374f7cf0406cf4d29c6e7f9f..284947437eacf1d527b613d883c40bb3eb5faa90 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -104,6 +104,8 @@ public class Main {
writePidFile(path);
}
+ org.dreeam.leaf.config.LeafConfig.loadConfig(); // Leaf - Leaf config
+
CrashReport.preload();
if (optionSet.has("jfrProfile")) { // CraftBukkit
JvmProfiler.INSTANCE.start(Environment.SERVER);
@@ -120,6 +122,7 @@ public class Main {
Bootstrap.bootStrap();
Bootstrap.validate();
Util.startTimerHackThread();
+ org.dreeam.leaf.config.ConfigModules.loadAfterBootstrap(); // Leaf - Leaf config - post load
Path path1 = Paths.get("server.properties");
DedicatedServerSettings dedicatedServerSettings = new DedicatedServerSettings(optionSet); // CraftBukkit - CLI argument support
dedicatedServerSettings.forceSave();
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index f6dd9e279155969ba05b44083018e074e11b0bb9..c4c7491dfee075e2c75f11631558bed89061f4f6 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1200,6 +1200,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.tick();
// Paper end
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
+ org.dreeam.leaf.config.LeafConfig.regSparkExtraConfig(); // Leaf - Leaf config
Arrays.fill(this.recentTps, 20);
// Paper start - further improve server tick loop
long tickSection = Util.getNanos();