99 lines
7.9 KiB
Diff
99 lines
7.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
|
|
From: MrHua269 <mrhua269@gmail.com>
|
||
|
|
Date: Wed, 8 Jul 2026 21:27:00 +0800
|
||
|
|
Subject: [PATCH] Force disable builtin spark plugin
|
||
|
|
|
||
|
|
The spark passed down from paper has some memory leaking issue, so we fully removed it from the code to prevent that memory leaking issue.
|
||
|
|
|
||
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||
|
|
index 78e9cf21fb5487e5eeec04e589c2a84c1e6b06af..b01e00de94d8fa45359d3d14a8481287276adb68 100644
|
||
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
||
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
||
|
|
@@ -672,8 +672,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
}
|
||
|
|
// Paper end - Configurable player collision; Handle collideRule team for player collision toggle
|
||
|
|
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||
|
|
- this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||
|
|
- this.server.spark.enableAfterPlugins(this.server); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
+ if (false) this.server.spark.enableAfterPlugins(this.server); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // Paper - reset invalid state for event fire below
|
||
|
|
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - call commands event for regular plugins
|
||
|
|
this.server.getCommandMap().registerServerAliases(); // Paper - relocate initial CommandMap#registerServerAliases() call
|
||
|
|
@@ -1087,7 +1087,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||
|
|
// CraftBukkit start
|
||
|
|
if (this.server != null) {
|
||
|
|
- this.server.spark.disable(); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.disable(); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
this.server.disablePlugins();
|
||
|
|
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
||
|
|
}
|
||
|
|
@@ -1350,7 +1350,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
this.statusIcon = this.loadStatusIcon().orElse(null);
|
||
|
|
this.status = this.buildServerStatus();
|
||
|
|
|
||
|
|
- this.server.spark.enableBeforePlugins(); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.enableBeforePlugins(); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
// Folia start - region threading
|
||
|
|
if (true) {
|
||
|
|
io.papermc.paper.threadedregions.RegionizedServer.getInstance().init(); // Folia - region threading - only after loading worlds
|
||
|
|
@@ -1664,7 +1664,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
}
|
||
|
|
|
||
|
|
if (this.emptyTicks >= emptyTickThreshold) {
|
||
|
|
- this.server.spark.tickStart(); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.tickStart(); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
if (this.emptyTicks == emptyTickThreshold) {
|
||
|
|
LOGGER.info("Server empty for {} seconds, pausing", this.pauseWhenEmptySeconds());
|
||
|
|
this.autoSave();
|
||
|
|
@@ -1683,7 +1683,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
// Paper end - avoid issues with certain tasks not processing during sleep
|
||
|
|
//this.server.spark.executeMainThreadTasks(); // Paper - spark // Folia - region threading
|
||
|
|
this.tickConnection();
|
||
|
|
- this.server.spark.tickEnd(((double)(System.nanoTime() - this.currentTickStart) / 1000000D)); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.tickEnd(((double)(System.nanoTime() - this.currentTickStart) / 1000000D)); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
@@ -1696,7 +1696,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
};
|
||
|
|
// Folia end - region threading
|
||
|
|
|
||
|
|
- this.server.spark.tickStart(); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.tickStart(); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
new com.destroystokyo.paper.event.server.ServerTickStartEvent((int)region.getCurrentTick()).callEvent(); // Paper - Server Tick Events // Folia - region threading
|
||
|
|
// Folia start - region threading
|
||
|
|
if (region != null) {
|
||
|
|
@@ -1773,7 +1773,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||
|
|
long remaining = scheduledEnd - endTime; // Folia - region ticking
|
||
|
|
new com.destroystokyo.paper.event.server.ServerTickEndEvent((int)io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick(), ((double)(endTime - startTime) / 1000000D), remaining).callEvent(); // Folia - region ticking
|
||
|
|
// Paper end - Server Tick Events
|
||
|
|
- this.server.spark.tickEnd(((double)(endTime - startTime) / 1000000D)); // Paper - spark // Folia - region threading
|
||
|
|
+ if (false) this.server.spark.tickEnd(((double)(endTime - startTime) / 1000000D)); // Paper - spark // Folia - region threading // Camellia - Force disable builtin spark
|
||
|
|
// Folia - region threading
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||
|
|
index 17244a82d7591004a43c013748f3db0507e73d7e..4d4a1475b315dd3cb855443ecd1fa75f05bb3502 100644
|
||
|
|
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||
|
|
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||
|
|
@@ -239,7 +239,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||
|
|
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||
|
|
// Paper end - initialize global and world-defaults configuration
|
||
|
|
moe.monnairealms.camellia.config.ConfigManager.loadConfigFiles(); // Camellia - Config system framework - load config file
|
||
|
|
- this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.enableEarlyIfRequested(); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||
|
|
if (this.convertOldUsers()) {
|
||
|
|
this.services().nameToIdCache().save(false); // Paper
|
||
|
|
@@ -249,7 +249,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||
|
|
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
|
||
|
|
consoleThread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
||
|
|
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||
|
|
- this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||
|
|
+ if (false) this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark // Camellia - Force disable builtin spark
|
||
|
|
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||
|
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||
|
|
|