95 lines
5.2 KiB
Diff
95 lines
5.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Fri, 16 Jan 2026 02:34:43 +0800
|
|
Subject: [PATCH] Add config to enable save-all command
|
|
|
|
|
|
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
index 11cacb26ce260373476dad764014ba1852477831..981f63b75584dbcb4bb0d5672e8c8bb140c52f9d 100644
|
|
--- a/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
@@ -364,6 +364,8 @@ public final class RegionizedServer {
|
|
// tick player ping sample
|
|
this.tickPlayerSample();
|
|
|
|
+ fun.bm.lophine.utils.SaveAllUtil.checkTimeout(); // Lophine - save-all fix
|
|
+
|
|
// tick worlds
|
|
for (final ServerLevel world : this.worlds) {
|
|
this.globalTick(world, tickCount);
|
|
diff --git a/io/papermc/paper/threadedregions/TickRegions.java b/io/papermc/paper/threadedregions/TickRegions.java
|
|
index 02c004bc7f9a0203523ce4b27cd766d6bdc478c0..3d86e21198f2888422330b6f7c27712f40a6aabc 100644
|
|
--- a/io/papermc/paper/threadedregions/TickRegions.java
|
|
+++ b/io/papermc/paper/threadedregions/TickRegions.java
|
|
@@ -190,6 +190,8 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
|
|
public final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> region;
|
|
public final ServerLevel world;
|
|
|
|
+ public long lastSavedTime = 0; // Lophine - save-all fix
|
|
+
|
|
// generic regionised data
|
|
private final Reference2ReferenceOpenHashMap<RegionizedData<?>, Object> regionizedData = new Reference2ReferenceOpenHashMap<>();
|
|
|
|
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
|
index 89f61f5715942d2b521e04b9fdc8b1b379c0c957..2c2487e1c1c65438119a13bd705a9e44697955ed 100644
|
|
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -299,7 +299,11 @@ public class Commands {
|
|
PardonCommand.register(this.dispatcher);
|
|
PardonIpCommand.register(this.dispatcher);
|
|
//PerfCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
- //SaveAllCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
+ // Lophine start - Add a config to enable save all command
|
|
+ if (fun.bm.lophine.config.modules.experiment.CommandConfig.saveAll) {
|
|
+ SaveAllCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
+ }
|
|
+ // Lophine end - Add a config to enable save all command
|
|
SaveOffCommand.register(this.dispatcher);
|
|
SaveOnCommand.register(this.dispatcher);
|
|
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index ef898f5b60219be00471f9ea227103dfcea5b202..4991b8a925d9431d80f42a4480d76d6602a85347 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1683,6 +1683,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// Folia start - region threading
|
|
public void tickServer(final long startTime, final long scheduledEnd, final long targetBuffer,
|
|
final io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
|
|
+ // Lophine start - save-all fix
|
|
+ if (fun.bm.lophine.utils.SaveAllUtil.isSaving()) {
|
|
+ fun.bm.lophine.utils.SaveAllUtil.postRegionSave(region);
|
|
+ }
|
|
+ // Lophine end - save-all fix
|
|
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
|
|
// Folia end - region threading
|
|
org.spigotmc.WatchdogThread.tick(); // Spigot
|
|
diff --git a/net/minecraft/server/commands/SaveAllCommand.java b/net/minecraft/server/commands/SaveAllCommand.java
|
|
index bc6d01996dde0870f6ebbda14176352777938a0c..8314d239435debf7aff947b7dd3bab83e3c80dc6 100644
|
|
--- a/net/minecraft/server/commands/SaveAllCommand.java
|
|
+++ b/net/minecraft/server/commands/SaveAllCommand.java
|
|
@@ -21,7 +21,9 @@ public class SaveAllCommand {
|
|
}
|
|
|
|
private static int saveAll(final CommandSourceStack source, final boolean flush) throws CommandSyntaxException {
|
|
- source.sendSuccess(() -> Component.translatable("commands.save.saving"), false);
|
|
+ // Lophine start - save all
|
|
+ fun.bm.lophine.utils.SaveAllUtil.preSaveAll(source, flush);
|
|
+/* source.sendSuccess(() -> Component.translatable("commands.save.saving"), false);
|
|
MinecraftServer server = source.getServer();
|
|
boolean success = server.saveEverything(true, flush, true);
|
|
if (!success) {
|
|
@@ -29,6 +31,12 @@ public class SaveAllCommand {
|
|
} else {
|
|
source.sendSuccess(() -> Component.translatable("commands.save.success"), true);
|
|
return 1;
|
|
- }
|
|
+ }*/
|
|
+ return 1;
|
|
}
|
|
+
|
|
+ public static SimpleCommandExceptionType getErrorFailed() {
|
|
+ return ERROR_FAILED;
|
|
+ }
|
|
+ // Lophine end - save all
|
|
}
|