From b1167a458af50dd5ba03c57701bf536f52530abd Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 10 Jun 2019 06:39:04 +0100 Subject: [PATCH] Improve autosave - don't trip manual save warning - respect world#isSavingDisabled --- .../incremental-chunk-saving.patch | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/Spigot-Server-Patches/incremental-chunk-saving.patch b/Spigot-Server-Patches/incremental-chunk-saving.patch index 933bfcded4..b03039c645 100644 --- a/Spigot-Server-Patches/incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/incremental-chunk-saving.patch @@ -42,7 +42,7 @@ index ef07f665b7..d89ad4e390 100644 private long t; @Nullable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 184f1b00f0..13e862aa9f 100644 +index 184f1b00f0..3dbe83c7ea 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0) world.getWorld().save(false); ++ for (WorldServer world : getWorlds()) { ++ if (world.paperConfig.autoSavePeriod > 0) { ++ try { ++ world.save(null, false, world.isSavingDisabled()); ++ } catch (ExceptionWorldConflict exceptionWorldConflict) { ++ MinecraftServer.LOGGER.warn(exceptionWorldConflict.getMessage()); ++ } ++ } + } + // Paper end + @@ -137,29 +143,4 @@ index 92aad060ef..c650f40b0d 100644 timings.worldSaveChunks.startTiming(); // Paper chunkproviderserver.save(flag); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0c53795306..4e60931cd8 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ public class CraftWorld implements World { - // Paper end - - @Override -+ // Paper start - public void save() { -+ save(true); -+ } -+ -+ public void save(boolean forceSave) { -+ // Paper end - this.server.checkSaveState(); - try { - boolean oldSave = world.savingDisabled; - - world.savingDisabled = false; -- world.save(null, false, false); -+ world.save(null, forceSave, false); // Paper - - world.savingDisabled = oldSave; - } catch (ExceptionWorldConflict ex) { -- \ No newline at end of file