SPIGOT-2014: Respect the spectatorsGenerateChunks gamerule

By: Thinkofname <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2016-04-20 11:00:35 +01:00
parent 8fe634523c
commit 77b2d0456e
2 changed files with 35 additions and 39 deletions

View File

@@ -103,7 +103,7 @@
return chunk;
}
@@ -61,20 +91,67 @@
@@ -61,20 +91,71 @@
Chunk chunk = this.getLoadedChunkAt(i, j);
if (chunk == null) {
@@ -137,6 +137,10 @@
+ }
+
+ public Chunk getChunkAt(int i, int j, Runnable runnable) {
+ return getChunkAt(i, j, runnable, true);
+ }
+
+ public Chunk getChunkAt(int i, int j, Runnable runnable, boolean generate) {
+ unloadQueue.remove(i, j);
+ Chunk chunk = chunks.get(LongHash.toLong(i, j));
+ ChunkRegionLoader loader = null;
@@ -153,7 +157,7 @@
+ } else {
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
+ }
+ } else if (chunk == null) {
+ } else if (chunk == null && generate) {
+ chunk = originalGetChunkAt(i, j);
+ }
+
@@ -173,7 +177,7 @@
if (chunk == null) {
long k = ChunkCoordIntPair.a(i, j);
@@ -92,11 +169,38 @@
@@ -92,11 +173,38 @@
crashreportsystemdetails.a("Generator", (Object) this.chunkGenerator);
throw new ReportedException(crashreport);
}
@@ -214,7 +218,7 @@
chunk.loadNearby(this, this.chunkGenerator);
}
@@ -142,10 +246,12 @@
@@ -142,10 +250,12 @@
public boolean a(boolean flag) {
int i = 0;
@@ -230,7 +234,7 @@
if (flag) {
this.saveChunkNOP(chunk);
@@ -170,22 +276,43 @@
@@ -170,22 +280,43 @@
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
@@ -281,7 +285,7 @@
this.chunkLoader.a();
}
@@ -198,7 +325,8 @@
@@ -198,7 +329,8 @@
}
public String getName() {
@@ -291,7 +295,7 @@
}
public List<BiomeBase.BiomeMeta> a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
@@ -210,10 +338,11 @@
@@ -210,10 +342,11 @@
}
public int g() {