papermc/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch

29 lines
1.1 KiB
Diff
Raw Normal View History

2016-05-12 02:07:46 +00:00
From 0241d5c821cff01bc4ad9d4b1b3611338228a68a Mon Sep 17 00:00:00 2001
2015-11-16 01:46:34 +00:00
From: Aikar <aikar@aikar.co>
2016-02-29 23:09:49 +00:00
Date: Wed, 2 Mar 2016 23:55:20 -0600
2015-11-16 01:46:34 +00:00
Subject: [PATCH] Don't create a chunk just to unload it
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2016-05-12 02:07:46 +00:00
index 898316f..46648bf 100644
2015-11-16 01:46:34 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2016-05-12 02:07:46 +00:00
@@ -213,7 +213,13 @@ public class CraftWorld implements World {
2016-04-04 14:53:03 +00:00
}
2015-11-16 01:46:34 +00:00
2016-04-04 14:53:03 +00:00
private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
2016-02-29 23:09:49 +00:00
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z);
+ // Paper start - Don't create a chunk just to unload it
2016-05-12 02:07:46 +00:00
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getLoadedChunkAt(x, z);
2015-11-16 01:46:34 +00:00
+ if (chunk == null) {
+ return false;
+ }
2016-02-29 23:09:49 +00:00
+ // Paper end
2016-04-04 14:53:03 +00:00
+
2015-11-16 01:46:34 +00:00
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
save = true;
}
--
2016-05-12 02:07:46 +00:00
2.8.2
2015-11-16 01:46:34 +00:00