diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 994eeabf74..73c9f163ba 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -50,7 +50,21 @@ } public boolean isLoaded(int i, int j) { -@@ -294,6 +302,18 @@ +@@ -289,11 +297,31 @@ + + @Override + public void close() throws IOException { +- this.save(true); ++ // CraftBukkit start ++ close(true); ++ } ++ ++ public void close(boolean save) throws IOException { ++ if (save) { ++ this.save(true); ++ } ++ // CraftBukkit end + this.lightEngine.close(); this.playerChunkMap.close(); } @@ -69,7 +83,7 @@ public void tick(BooleanSupplier booleansupplier) { this.world.getMethodProfiler().enter("purge"); this.chunkMapDistance.purgeTickets(); -@@ -313,13 +333,13 @@ +@@ -313,13 +341,13 @@ this.lastTickTime = i; WorldData worlddata = this.world.getWorldData(); boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES; @@ -85,7 +99,7 @@ this.world.getMethodProfiler().enter("naturalSpawnCount"); int l = this.chunkMapDistance.b(); -@@ -348,8 +368,30 @@ +@@ -348,8 +376,30 @@ for (int j1 = 0; j1 < i1; ++j1) { EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1]; @@ -117,7 +131,7 @@ if (object2intmap.getInt(enumcreaturetype) <= k1) { SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition); -@@ -497,12 +539,18 @@ +@@ -497,12 +547,18 @@ @Override protected boolean executeNext() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 7c32c967f9..ef62a9ffe6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -981,13 +981,14 @@ public final class CraftServer implements Server { return false; } - if (save) { - try { + try { + if (save) { handle.save(null, true, true); - handle.close(); - } catch (Exception ex) { - getLogger().log(Level.SEVERE, null, ex); } + + handle.getChunkProvider().close(save); + } catch (Exception ex) { + getLogger().log(Level.SEVERE, null, ex); } worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));