Paper/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch
2016-06-08 23:42:46 -05:00

29 lines
1.1 KiB
Diff

From b6e34821d3030412b88b2634b2204224b31be785 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 2 Mar 2016 23:55:20 -0600
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
index 4ab7efc..d1385af 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -213,7 +213,13 @@ public class CraftWorld implements World {
}
private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z);
+ // Paper start - Don't create a chunk just to unload it
+ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
+ if (chunk == null) {
+ return false;
+ }
+ // Paper end
+
if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data
save = true;
}
--
2.8.3