Restore Configurable Allowance of Perm Chunk Loaders

This commit is contained in:
Aikar 2018-07-21 17:03:26 -04:00
parent 13e34d8e1c
commit 34404e60c9
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
1 changed files with 13 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From b3c4cbe3e4019d14276d36954449d2d91825336a Mon Sep 17 00:00:00 2001
From eb46618fcdc4a12a5c3b48cbe4c9b3b2d1813ac5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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