9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0003-Leaf-config.patch
2025-06-30 02:16:54 +08:00

44 lines
2.2 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 9c9b601a3f903bebb0dd1bda0e24745587229727..6c65122fe15e08c352885c7dfd3ddf496f0c00c4 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -108,10 +108,12 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
+ org.dreeam.leaf.config.LeafConfig.loadConfig(); // Leaf - Leaf config
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
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 96d34149b1009b1522335784bc1858f61bb59cd1..d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1182,6 +1182,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();