From eba1fb22478976b94462f92cd794f5e6abeadaf9 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 --- .../0400-incremental-chunk-saving.patch | 41 +++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/Spigot-Server-Patches/0400-incremental-chunk-saving.patch b/Spigot-Server-Patches/0400-incremental-chunk-saving.patch index 186ac1af87..49f3319511 100644 --- a/Spigot-Server-Patches/0400-incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/0400-incremental-chunk-saving.patch @@ -1,4 +1,4 @@ -From c5851b2a5288702fd63f5ab5d199868ab6222d48 Mon Sep 17 00:00:00 2001 +From 82e112148beccdfbb3079008b4e56ee029a17048 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 9 Jun 2019 03:53:22 +0100 Subject: [PATCH] incremental chunk saving @@ -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 @@ -156,6 +156,7 @@ 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,31 +143,6 @@ 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 -@@ -1151,13 +1151,19 @@ 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) { -- 2.21.0