From 34404e60c93c4e92c49d5ba9186bac92d85033e5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 21 Jul 2018 17:03:26 -0400 Subject: [PATCH] Restore Configurable Allowance of Perm Chunk Loaders --- ...Allowance-of-Permanent-Chunk-Loaders.patch | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) rename removed/server/0292-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch => Spigot-Server-Patches/0303-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch (58%) diff --git a/removed/server/0292-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch b/Spigot-Server-Patches/0303-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch similarity index 58% rename from removed/server/0292-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch rename to Spigot-Server-Patches/0303-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch index 5c6925a575..709a2a08bd 100644 --- a/removed/server/0292-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch +++ b/Spigot-Server-Patches/0303-Configurable-Allowance-of-Permanent-Chunk-Loaders.patch @@ -1,4 +1,4 @@ -From b3c4cbe3e4019d14276d36954449d2d91825336a Mon Sep 17 00:00:00 2001 +From eb46618fcdc4a12a5c3b48cbe4c9b3b2d1813ac5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 21 Apr 2018 11:21:48 -0400 Subject: [PATCH] Configurable Allowance of Permanent Chunk Loaders @@ -7,14 +7,13 @@ This disables the behavior that allows players to keep chunks permanently loaded by default and allows server operators to enable it if they wish. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5a2fbf7c7..99d681ef1 100644 +index ba6d5b7ff..b9f5f4905 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -507,4 +507,10 @@ public class PaperWorldConfig { - private void disableSprintInterruptionOnAttack() { - disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); +@@ -466,4 +466,9 @@ public class PaperWorldConfig { + break; + } } -+ + public boolean allowPermaChunkLoaders = false; + private void allowPermaChunkLoaders() { + allowPermaChunkLoaders = getBoolean("game-mechanics.allow-permanent-chunk-loaders", allowPermaChunkLoaders); @@ -22,18 +21,18 @@ index 5a2fbf7c7..99d681ef1 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 55dada668..0eba3df57 100644 +index 70790386e..7f83ed51d 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -148,7 +148,7 @@ public class ChunkProviderServer implements IChunkProvider { - } +@@ -111,7 +111,7 @@ public class ChunkProviderServer implements IChunkProvider { + Long2ObjectMap long2objectmap = this.chunks; - public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) { -- Chunk chunk = getLoadedChunkAt(i, j); -+ Chunk chunk = world.paperConfig.allowPermaChunkLoaders ? getLoadedChunkAt(i, j) : getChunkIfLoaded(i, j); // Paper - Configurable perma chunk loaders - ChunkRegionLoader loader = null; + synchronized (this.chunks) { +- Chunk chunk = this.getLoadedChunkAt(i, j); ++ Chunk chunk = world.paperConfig.allowPermaChunkLoaders ? getLoadedChunkAt(i, j) : getChunkIfLoaded(i, j); // Paper - Configurable perma chunk loaders - if (this.chunkLoader instanceof ChunkRegionLoader) { + return chunk != null ? chunk : this.loadChunkAt(i, j); + } -- 2.18.0