diff options
author | Aikar <[email protected]> | 2016-06-07 02:08:59 -0400 |
---|---|---|
committer | Aikar <[email protected]> | 2016-06-07 02:08:59 -0400 |
commit | a9d82375090f9a52367235e3447e48702fba2985 (patch) | |
tree | 46ab3e5f871605cd6230aa0301c16871933b665b | |
parent | 092733e8ffb29344bc8c2dbd1397a5ed78bf5308 (diff) | |
download | Paper-a9d82375090f9a52367235e3447e48702fba2985.tar.gz Paper-a9d82375090f9a52367235e3447e48702fba2985.zip |
more chunk unload queue fixes, hopefully fix various odd bugs
3 files changed, 74 insertions, 38 deletions
diff --git a/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch b/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch index 0ee1419e33..66fdf4017e 100644 --- a/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch +++ b/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch @@ -1,11 +1,11 @@ -From 0241d5c821cff01bc4ad9d4b1b3611338228a68a Mon Sep 17 00:00:00 2001 +From 064ef8799679a16ccfc7538d2796d374f4a1b0f4 Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> 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 898316f..46648bf 100644 +index 899ce8f..83b14d9 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 { @@ -14,7 +14,7 @@ index 898316f..46648bf 100644 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().getLoadedChunkAt(x, z); ++ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z); + if (chunk == null) { + return false; + } @@ -24,5 +24,5 @@ index 898316f..46648bf 100644 save = true; } -- -2.8.2 +2.8.3 diff --git a/Spigot-Server-Patches/0152-Fix-Chunk-Unload-Queue-Issues.patch b/Spigot-Server-Patches/0152-Fix-Chunk-Unload-Queue-Issues.patch new file mode 100644 index 0000000000..b5d2fc282c --- /dev/null +++ b/Spigot-Server-Patches/0152-Fix-Chunk-Unload-Queue-Issues.patch @@ -0,0 +1,70 @@ +From 11580ee1b1f7b4c824750e7bc35e86acb15e21f5 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Thu, 12 May 2016 02:03:56 -0400 +Subject: [PATCH] Fix Chunk Unload Queue Issues + +Vanilla implemented similar logic as Paper had pre 1.9.4, but Spigot +has not resolved all the bugs with the changes. + +This patch fixes known issues and really should be applied by Spigot team. + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index d7b9581..e3cc816 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -47,7 +47,7 @@ public class Chunk { + private long w; + private int x; + private ConcurrentLinkedQueue<BlockPosition> y; +- public boolean d; ++ public boolean d;public void setShouldUnload(boolean unload) { this.d = unload; } public boolean isUnloading() { return d; } // Paper // OBFHELPER + protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot + + // Paper start +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 6d1b98b..4a2cad6 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider { + Chunk chunk = (Chunk) this.chunks.get(olong); + + if (chunk != null && chunk.d) { ++ chunk.setShouldUnload(false); // Paper + // CraftBukkit start + ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk); + this.world.getServer().getPluginManager().callEvent(event); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 03dae89..58f5141 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -303,6 +303,9 @@ public class CraftWorld implements World { + // Use the default variant of loadChunk when generate == true. + return world.getChunkProviderServer().getChunkAt(x, z) != null; + } ++ // Paper start - below is not updated for the new unload queue logic. ++ return world.getChunkProviderServer().getOrLoadChunkAt(x, z) != null; ++ /* + + world.getChunkProviderServer().unloadQueue.remove(ChunkCoordIntPair.a(x, z)); + net.minecraft.server.Chunk chunk = world.getChunkProviderServer().chunks.get(ChunkCoordIntPair.a(x, z)); +@@ -312,7 +315,7 @@ public class CraftWorld implements World { + chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot + } +- return chunk != null; ++ return chunk != null;*/ // Paper end + } + + private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) { +@@ -1548,7 +1551,7 @@ public class CraftWorld implements World { + } + + // Already unloading? +- if (cps.unloadQueue.contains(ChunkCoordIntPair.a(chunk.locX, chunk.locZ))) { ++ if (chunk.isUnloading()) { // Paper + continue; + } + +-- +2.8.3 + diff --git a/Spigot-Server-Patches/0152-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch b/Spigot-Server-Patches/0152-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch deleted file mode 100644 index 31f29e71c4..0000000000 --- a/Spigot-Server-Patches/0152-Unmark-chunk-as-unloading-when-unload-is-cancelled.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 315afb375674d27304fae4183a583984e739055f Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Thu, 12 May 2016 02:03:56 -0400 -Subject: [PATCH] Unmark chunk as unloading when unload is cancelled - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index d7b9581..40d4c9c 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -47,7 +47,7 @@ public class Chunk { - private long w; - private int x; - private ConcurrentLinkedQueue<BlockPosition> y; -- public boolean d; -+ public boolean d;public void setShouldUnload(boolean unload) { this.d = unload; } // Paper // OBFHELPER - protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot - - // Paper start -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 6d1b98b..4a2cad6 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider { - Chunk chunk = (Chunk) this.chunks.get(olong); - - if (chunk != null && chunk.d) { -+ chunk.setShouldUnload(false); // Paper - // CraftBukkit start - ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk); - this.world.getServer().getPluginManager().callEvent(event); --- -2.7.4 (Apple Git-66) - |