aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2016-05-13 22:27:20 -0400
committerAikar <[email protected]>2016-05-13 22:27:20 -0400
commit024bc323bc83ba6bfddfa24a05495b081ed42ed5 (patch)
tree3912404b5426910c97a20eb5143582a90ca0951e
parentdb83abe17d5dd21d8db90f411a51dbad30203bfa (diff)
downloadPaper-024bc323bc83ba6bfddfa24a05495b081ed42ed5.tar.gz
Paper-024bc323bc83ba6bfddfa24a05495b081ed42ed5.zip
More cases of avoiding marking active for chunks, to stop potential leaks
-rw-r--r--Spigot-Server-Patches/0004-MC-Utils.patch13
-rw-r--r--Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch40
2 files changed, 46 insertions, 7 deletions
diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch
index 60461f24cb..82d244906f 100644
--- a/Spigot-Server-Patches/0004-MC-Utils.patch
+++ b/Spigot-Server-Patches/0004-MC-Utils.patch
@@ -1,4 +1,4 @@
-From 3e274493dd2ceaa090253d2797e7c5bdbd55d2d5 Mon Sep 17 00:00:00 2001
+From 09eb35c8f468ea83f5595c8e6e2b89614628641b Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
@@ -7,10 +7,10 @@ Collection of utils to help reduce NMS diff
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644
-index 0000000..d3a256c
+index 0000000..cf7c48f
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
-@@ -0,0 +1,141 @@
+@@ -0,0 +1,142 @@
+package net.minecraft.server;
+
+import org.bukkit.Location;
@@ -18,7 +18,7 @@ index 0000000..d3a256c
+import javax.annotation.Nullable;
+import java.util.regex.Pattern;
+
-+public class MCUtil {
++public final class MCUtil {
+ private static final Pattern REPLACE_QUOTES = Pattern.compile("\"");
+
+ private MCUtil() {}
@@ -141,6 +141,7 @@ index 0000000..d3a256c
+ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(World world, int x, int z) {
+ return ((ChunkProviderServer) world.chunkProvider).chunks.get(ChunkCoordIntPair.a(x, z));
+ }
++
+ /**
+ * Gets a chunk without changing its boolean for should unload
+ * @param provider
@@ -148,8 +149,8 @@ index 0000000..d3a256c
+ * @param z
+ * @return
+ */
-+ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(ChunkProviderServer provider, int x, int z) {
-+ return provider.chunks.get(ChunkCoordIntPair.a(x, z));
++ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(IChunkProvider provider, int x, int z) {
++ return ((ChunkProviderServer)provider).chunks.get(ChunkCoordIntPair.a(x, z));
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
diff --git a/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch b/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch
index 0c0f0c0ed5..454035800a 100644
--- a/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch
+++ b/Spigot-Server-Patches/0152-Do-not-mark-chunks-as-active-for-neighbor-updates.patch
@@ -1,10 +1,48 @@
-From 9df0a1beae6afe76606eb96db443a735faf77eba Mon Sep 17 00:00:00 2001
+From 82bf7c14dccf3f1c88c4760a2edf709c542358fb Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Thu, 12 May 2016 01:55:17 -0400
Subject: [PATCH] Do not mark chunks as active for neighbor updates
Fixes chunk unload issues
+diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
+index 1e172b8..90eba27 100644
+--- a/src/main/java/net/minecraft/server/Chunk.java
++++ b/src/main/java/net/minecraft/server/Chunk.java
+@@ -1021,25 +1021,25 @@ public class Chunk {
+
+ public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) {
+ world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
+- Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1);
+- Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ);
+- Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1);
+- Chunk chunk3 = ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ);
++ Chunk chunk = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX, this.locZ - 1); // Paper
++ Chunk chunk1 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ); // Paper
++ Chunk chunk2 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX, this.locZ + 1); // Paper
++ Chunk chunk3 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ); // Paper
+
+- if (chunk1 != null && chunk2 != null && ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ + 1) != null) {
++ if (chunk1 != null && chunk2 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ + 1) != null) { // Paper
+ this.a(chunkgenerator);
+ }
+
+- if (chunk3 != null && chunk2 != null && ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ + 1) != null) {
++ if (chunk3 != null && chunk2 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ + 1) != null) { // Paper
+ chunk3.a(chunkgenerator);
+ }
+
+- if (chunk != null && chunk1 != null && ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ - 1) != null) {
++ if (chunk != null && chunk1 != null && MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX + 1, this.locZ - 1) != null) { // Paper
+ chunk.a(chunkgenerator);
+ }
+
+ if (chunk != null && chunk3 != null) {
+- Chunk chunk4 = ichunkprovider.getLoadedChunkAt(this.locX - 1, this.locZ - 1);
++ Chunk chunk4 = MCUtil.getLoadedChunkWithoutMarkingActive(ichunkprovider,this.locX - 1, this.locZ - 1); // Paper
+
+ if (chunk4 != null) {
+ chunk4.a(chunkgenerator);
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 8ee8e80..1bc001d 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java