2014-01-22 08:23:59 +00:00
From 9d257eb2927d480f108701500d0a300d1ecd617d Mon Sep 17 00:00:00 2001
2014-01-12 10:07:27 +00:00
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-01-22 08:23:59 +00:00
index 7616d7b..588ce0a 100644
2014-01-12 10:07:27 +00:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2014-01-22 08:23:59 +00:00
@@ -568,7 +568,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
2014-01-12 10:07:27 +00:00
if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit
this.methodProfiler.a("save");
this.t.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();
}
--
2014-01-22 08:16:12 +00:00
1.8.3.2
2014-01-12 10:07:27 +00:00