3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 13:30:06 +01:00
Paper/CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch

33 Zeilen
1.7 KiB
Diff

2014-11-28 02:17:45 +01:00
From 2a40e42c5a2306b047bc3b6d913aac81f51210a2 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 12 Jan 2014 21:07:18 +1100
Subject: [PATCH] Replace AutoSave Mechanism
The problem here is that MinecraftServer.save(..), will attempt to sleep whilst all pending chunks are written to disk, however due to various and complicated bugs, it will wait for an incorrect amount of chunks, which may cause it to sleep for an overly long amount of time. Instead we will mimic the save-all command in its behaviour, which is both safe and performant.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
2014-11-28 02:17:45 +01:00
index b686a49..5c7a9c6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2014-11-28 02:17:45 +01:00
@@ -625,7 +625,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
SpigotTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save");
2014-11-28 02:17:45 +01:00
this.v.savePlayers();
- this.saveChunks(true);
+ // Spigot Start
+ // We replace this with saving each individual world as this.saveChunks(...) is broken,
+ // and causes the main thread to sleep for random amounts of time depending on chunk activity
+ server.playerCommandState = true;
+ for (World world : worlds) {
+ world.getWorld().save();
+ }
+ server.playerCommandState = false;
+ // this.saveChunks(true);
+ // Spigot End
this.methodProfiler.b();
SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
--
2014-11-28 02:17:45 +01:00
2.1.0