Fix chunks refusing to save (#2196)

We should only set hasBeenLoaded to false potentially after saving a chunk
other wise we will not save it. The method to do this is
PlayerChunk#l(), which we were potentially calling for chunks we were not saving.
This commit is contained in:
Spottedleaf
2019-06-17 00:47:51 -07:00
parent 90153c12f5
commit a4a1cae173
3 changed files with 15 additions and 11 deletions

View File

@@ -86,7 +86,7 @@ index 184f1b00f0..3dbe83c7ea 100644
this.methodProfiler.enter("snooper");
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 7d48b580ac..86831c3526 100644
index 7d48b580ac..b71f98b0c5 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -103,28 +103,32 @@ index 7d48b580ac..86831c3526 100644
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
- this.saveChunk(ichunkaccess);
- playerchunk.l();
- }
+ // paper start
+ boolean shouldSave = true;
+
- });
+ if (ichunkaccess instanceof Chunk) {
+ shouldSave = ((Chunk) ichunkaccess).lastSaved + world.paperConfig.autoSavePeriod <= world.getTime();
+ }
+
+ if (shouldSave && this.saveChunk(ichunkaccess)) ++savedThisTick;
playerchunk.l();
+ if (shouldSave && this.saveChunk(ichunkaccess)) {
+ ++savedThisTick;
+ playerchunk.l();
+ }
+
+ if (savedThisTick >= world.paperConfig.maxAutoSaveChunksPerTick) {
+ return;
+ }
}
-
- });
+ }
+ };
+ // paper end
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 92aad060ef..1c3815a9c4 100644
index 40b3d96edd..135ec94c6f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World {