Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require it to be initialized earlier. By moving it to the superclass, we
initialize it earlier, ensuring that it is available sooner.

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 745ec876080331f27f3eabf466ff914d39c8d2c4..d9f97558c650c7a45e25780ef274eb92d48d797e 100644
index d22b619eb47cd99b7d3d44bf0fa5c6278bbaaf6a..16a0f7ede6924fee0019c6b054b96a2eaf68677d 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -979,8 +979,6 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index d9f97558c650c7a45e25780ef274eb92d48d797e..d8eeba21a5392af3b0f943296c0f943c38d23fc3 100644
index 16a0f7ede6924fee0019c6b054b96a2eaf68677d..7952d6836743b6ed88221503c905d5c0dfa56e82 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -1059,7 +1059,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index d8eeba21a5392af3b0f943296c0f943c38d23fc3..aa54ee4700d7a13439987dfaad3095faf5bbf19e 100644
index 7952d6836743b6ed88221503c905d5c0dfa56e82..a02889c57217422b6231b9708ed8f7cb423da27c 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -919,7 +919,19 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ index 98f07bacb2a94b368c1969dc0cfb11b72f6cea1a..6755281b1dedf2078e1623918985de77
}

diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index bc08326c6b8e0657357f57f9bc47ef3c55f7744f..306ab28189d3272efbdaaf09444accf52f570fee 100644
index 6638155dd34519592893bf992ad5050f30c39626..d8940a667cf9c8216dd67add38debc86c3e276c6 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -692,6 +692,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ index 6755281b1dedf2078e1623918985de772bb78dfe..aa30556730b3c924f72ccd8702a88c38
final ServerLevel world = this.level;
final int randomTickSpeed = world.getGameRules().get(GameRules.RANDOM_TICK_SPEED);
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 306ab28189d3272efbdaaf09444accf52f570fee..0817fd8c0006272f1ed0bce560f1200324ff42ec 100644
index d8940a667cf9c8216dd67add38debc86c3e276c6..72b03879dee9613423648dd2763a76a28f375704 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -998,7 +998,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
Expand Down Expand Up @@ -97,7 +97,7 @@ index 664c1b3008b62c533b8e3302baa994ed0c135c42..bce2fc4fa3fc56edb2a29e5ba695ac8f
static RandomSource createThreadLocalInstance(final long seed) {
return new SingleThreadedRandomSource(seed);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 7035d1ede6383c2016685cd2ca2f86e269f75c73..50c424b1d498d052bd27f37e855d0db3f780ee0b 100644
index c2b845232253f3930ef90e8970b745c3dfea9bbf..4845fc18afed8229a2a4f00de1269145ceacdfe0 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -173,7 +173,7 @@ public abstract class Entity
Expand Down
550 changes: 550 additions & 0 deletions leaf-server/minecraft-patches/features/0326-Leaf-config-changes.patch

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index c9dccaa61c6b216ae9c827b8eed5d7a21cccef15..59392b5a240ebee6517670e10e637ad0

@Override
public double[] getTPS() {
+ if (org.dreeam.leaf.config.modules.misc.Including5sIngetTPS.enabled) return getTPSIncluding5SecondAverage(); // Leaf - Including 5s in getTPS()
+ if (org.dreeam.leaf.config.modules.misc.Including5sInGetTPS.enabled) return getTPSIncluding5SecondAverage(); // Leaf - Including 5s in getTPS()
return this.getServer().getTPS();
}

141 changes: 141 additions & 0 deletions leaf-server/paper-patches/features/0068-Leaf-config-changes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sat, 15 Aug 2026 09:05:57 +0800
Subject: [PATCH] Leaf config changes


diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index 77ba1fb52b291a9b205cdf0e571c7de03fa24686..be5b329aa6c50eda9e574a97e9018c4f4ce35413 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -317,7 +317,7 @@ public final class ChatProcessor {

private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, !org.dreeam.leaf.config.modules.network.ChatMessageSignature.enabled || !org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.chat.notSecureMarker || ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure"); // Gale - do not log Not Secure marker // Leaf - Mirai - Configurable chat message signatures
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, !org.dreeam.leaf.config.modules.network.ChatMessageSignature.enabled || !org.dreeam.leaf.config.modules.misc.global.Chat.notSecureMarker || ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure"); // Gale - do not log Not Secure marker // Leaf - Mirai - Configurable chat message signatures
}
}

diff --git a/src/main/java/io/papermc/paper/world/migration/LegacyCraftBukkitWorldMigration.java b/src/main/java/io/papermc/paper/world/migration/LegacyCraftBukkitWorldMigration.java
index ba24fda2395f07cdb3d1c0c66811dfd4a5b81533..f8b8fb411a65b6b06f24aec1470eee1a71f1f433 100644
--- a/src/main/java/io/papermc/paper/world/migration/LegacyCraftBukkitWorldMigration.java
+++ b/src/main/java/io/papermc/paper/world/migration/LegacyCraftBukkitWorldMigration.java
@@ -83,6 +83,7 @@ final class LegacyCraftBukkitWorldMigration {
}

WorldMigrationSupport.migratePaperWorldConfig(this.sourceRoot, this.targetDimensionPath);
+ WorldMigrationSupport.migrateGaleWorldConfig(this.sourceRoot, this.targetDimensionPath); // Leaf - migrate legacy Gale world config

final var levelDataResult = WorldMigrationSupport.readFixedLevelData(sourceAccess);
if (levelDataResult.fatalError()) {
@@ -163,7 +164,9 @@ final class LegacyCraftBukkitWorldMigration {
if (Files.isDirectory(root.resolve(LevelResource.DATA.id()))) {
return true;
}
- if (Files.isRegularFile(root.resolve(WorldMigrationSupport.PAPER_WORLD_CONFIG)) || Files.isRegularFile(root.resolve(WorldMigrationSupport.LEGACY_UID_FILE_NAME))) {
+ if (Files.isRegularFile(root.resolve(WorldMigrationSupport.PAPER_WORLD_CONFIG))
+ || Files.isRegularFile(root.resolve(WorldMigrationSupport.GALE_WORLD_CONFIG)) // Leaf - preserve legacy Gale world config
+ || Files.isRegularFile(root.resolve(WorldMigrationSupport.LEGACY_UID_FILE_NAME))) {
return true;
}
for (final String directory : WorldMigrationSupport.DIMENSION_DIRECTORIES) {
diff --git a/src/main/java/io/papermc/paper/world/migration/VanillaWorldMigration.java b/src/main/java/io/papermc/paper/world/migration/VanillaWorldMigration.java
index 00ab529b50f3cd8b5e0b3256d500e00066ade762..18b5ee30d419e1c275eec67c24b6364914cc7437 100644
--- a/src/main/java/io/papermc/paper/world/migration/VanillaWorldMigration.java
+++ b/src/main/java/io/papermc/paper/world/migration/VanillaWorldMigration.java
@@ -46,6 +46,7 @@ final class VanillaWorldMigration {

if (rootOwnsThisWorld) {
WorldMigrationSupport.migratePaperWorldConfig(context.baseRoot(), context.targetDimensionPath());
+ WorldMigrationSupport.migrateGaleWorldConfig(context.baseRoot(), context.targetDimensionPath()); // Leaf - migrate legacy Gale world config
migrateLegacyWorldMetadata(context);
}

diff --git a/src/main/java/io/papermc/paper/world/migration/WorldMigrationSupport.java b/src/main/java/io/papermc/paper/world/migration/WorldMigrationSupport.java
index f961539a3e38b8fedc882aa8ee66766193ac4ccb..d3c47277decb82b6f7bd47663c10674481b0ff59 100644
--- a/src/main/java/io/papermc/paper/world/migration/WorldMigrationSupport.java
+++ b/src/main/java/io/papermc/paper/world/migration/WorldMigrationSupport.java
@@ -29,6 +29,7 @@ final class WorldMigrationSupport {
private static final Logger LOGGER = LogUtils.getClassLogger();
static final List<String> DIMENSION_DIRECTORIES = List.of("region", "entities", "poi");
static final String PAPER_WORLD_CONFIG = "paper-world.yml";
+ static final String GALE_WORLD_CONFIG = "gale-world.yml";
static final String LEGACY_UID_FILE_NAME = "uid.dat";

private WorldMigrationSupport() {
@@ -68,18 +69,26 @@ final class WorldMigrationSupport {
}

static void migratePaperWorldConfig(final Path sourceRoot, final Path targetDimensionPath) throws IOException {
- final Path source = sourceRoot.resolve(PAPER_WORLD_CONFIG);
+ migrateWorldConfig(sourceRoot, targetDimensionPath, PAPER_WORLD_CONFIG, "Paper");
+ }
+
+ static void migrateGaleWorldConfig(final Path sourceRoot, final Path targetDimensionPath) throws IOException {
+ migrateWorldConfig(sourceRoot, targetDimensionPath, GALE_WORLD_CONFIG, "Gale");
+ }
+
+ private static void migrateWorldConfig(final Path sourceRoot, final Path targetDimensionPath, final String fileName, final String configName) throws IOException {
+ final Path source = sourceRoot.resolve(fileName);
if (!Files.isRegularFile(source)) {
return;
}

- final Path target = targetDimensionPath.resolve(PAPER_WORLD_CONFIG);
+ final Path target = targetDimensionPath.resolve(fileName);
if (Files.exists(target)) {
return;
}

Files.createDirectories(target.getParent());
- LOGGER.info("Migrating Paper world config from {} to {}", source, target);
+ LOGGER.info("Migrating {} world config from {} to {}", configName, source, target);
Files.move(source, target);
}

diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 22e244d63d13dffc1efa091ac8853a4fb224a958..7eecca5538e48f238b3d1d956501532fefba6b21 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1005,7 +1005,6 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur - Purpur config files
- this.console.galeConfigurations.reloadConfigs(this.console); // Gale - Gale configuration
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.isSpawningMonsters()); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
index 0efca0e1de2d6e5d9bc33c46174973758c8cabb3..5bd6d0062f09a23bc8562ac313816143e2abc8a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
@@ -260,7 +260,7 @@ public final class CraftLegacy {
}

static {
- if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.legacyMaterialInitialization) LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error // Gale - Purpur - do not log legacy Material initialization
+ if (org.dreeam.leaf.config.modules.misc.global.LogToConsole.legacyMaterialInitialization) LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error // Gale - Purpur - do not log legacy Material initialization
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
new Exception().printStackTrace();
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 5a6347c8a7909ab25c302fdc9fd1e8a615ebe488..db168a9bde8fa447d50edd25f97383e93807b7b1 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -51,13 +51,13 @@ public class TicksPerSecondCommand extends Command {
builder.append(Component.join(JoinConfiguration.commas(true), tpsAvg));
sender.sendMessage(builder.asComponent());
// Gale start - YAPFA - last tick time - in TPS command
- if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.lastTickTimeInTpsCommand.enabled) {
+ if (org.dreeam.leaf.config.modules.misc.global.LastTickTimeInTpsCommand.enabled) {
long lastTickProperTime = net.minecraft.server.MinecraftServer.lastTickProperTime;
long lastTickOversleepTime = net.minecraft.server.MinecraftServer.lastTickOversleepTime;
var lastTickTimeMessage = text("Last tick: ")
.append(formatTickTimeDuration(lastTickProperTime, 44, 50, 51));

- if (org.galemc.gale.configuration.GaleGlobalConfiguration.get().misc.lastTickTimeInTpsCommand.addOversleep) {
+ if (org.dreeam.leaf.config.modules.misc.global.LastTickTimeInTpsCommand.addOversleep) {
lastTickTimeMessage = lastTickTimeMessage.append(text(" self + "))
.append(formatTickTimeDuration(lastTickOversleepTime, Math.max(1, 51 - lastTickProperTime), Math.max(2, 52 - lastTickProperTime), Math.max(3, 53 - lastTickProperTime)))
.append(text(" oversleep = "))
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ private static int getCorePoolSize() {
}

private static int getMaxPoolSize() {
return AsyncPathfinding.asyncPathfindingMaxThreads;
return AsyncPathfinding.maxThreads;
}

private static long getKeepAliveTime() {
return AsyncPathfinding.asyncPathfindingKeepalive;
return AsyncPathfinding.keepalive;
}

private static BlockingQueue<Runnable> getQueueImpl() {
final int queueCapacity = AsyncPathfinding.asyncPathfindingQueueSize;
final int queueCapacity = AsyncPathfinding.queueSize;

return new LinkedBlockingQueue<>(queueCapacity);
}
Expand All @@ -103,7 +103,7 @@ private static RejectedExecutionHandler getRejectedPolicy() {
return (Runnable rejectedTask, ThreadPoolExecutor executor) -> {
BlockingQueue<Runnable> workQueue = executor.getQueue();
if (!executor.isShutdown()) {
switch (AsyncPathfinding.asyncPathfindingRejectPolicy) {
switch (AsyncPathfinding.rejectPolicyType) {
case FLUSH_ALL -> {
if (!workQueue.isEmpty()) {
List<Runnable> pendingTasks = new ArrayList<>(workQueue.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public static PathfindTaskRejectPolicy fromString(String policy) {
try {
return PathfindTaskRejectPolicy.valueOf(policy.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
LeafConfig.LOGGER.warn("Invalid pathfind task reject policy: {}, falling back to {}.", policy, FLUSH_ALL.toString());
return FLUSH_ALL;
LeafConfig.LOGGER.warn("Invalid pathfind task reject policy: {}, falling back to {}.", policy, CALLER_RUNS.toString());
return CALLER_RUNS;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.server.MinecraftServer;
import org.dreeam.leaf.command.LeafCommand;
import org.dreeam.leaf.command.PermissionedLeafSubcommand;
import org.dreeam.leaf.config.LeafConfig;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.permissions.PermissionDefault;

public final class ReloadCommand extends PermissionedLeafSubcommand {
Expand All @@ -22,23 +20,10 @@ public ReloadCommand() {

@Override
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
this.doGaleReload(sender);
this.doLeafReload(sender);
return true;
}

// Gale start - Gale commands - /gale reload command
private void doGaleReload(final CommandSender sender) {
Command.broadcastCommandMessage(sender, Component.text("Reloading Gale config...", NamedTextColor.GREEN));

MinecraftServer server = ((CraftServer) sender.getServer()).getServer();
server.galeConfigurations.reloadConfigs(server);
server.server.reloadCount++;

Command.broadcastCommandMessage(sender, Component.text("Gale config reload complete.", NamedTextColor.GREEN));
}
// Gale end - Gale commands - /gale reload command

private void doLeafReload(final CommandSender sender) {
Command.broadcastCommandMessage(sender, Component.text("Reloading Leaf config...", NamedTextColor.GREEN));

Expand Down
Loading
Loading