2021-03-16 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								--- a/net/minecraft/server/level/ChunkProviderServer.java
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+++ b/net/minecraft/server/level/ChunkProviderServer.java
 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -85,6 +85,16 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-06 19:23:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         this.clearCache();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    // CraftBukkit start - properly implement isChunkLoaded
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    public boolean isChunkLoaded(int chunkX, int chunkZ) {
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        PlayerChunk chunk = this.chunkMap.getUpdatingChunkIfPresent(ChunkCoordIntPair.asLong(chunkX, chunkZ));
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-06 19:23:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        if (chunk == null) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            return false;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-27 16:24:06 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        return chunk.getFullChunkNow() != null;
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-06 19:23:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    // CraftBukkit end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     @Override
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     public LightEngineThreaded getLightEngine() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         return this.lightEngine;
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -129,7 +139,7 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             for (int l = 0; l < 4; ++l) {
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                 if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                     ichunkaccess = this.lastChunk[l];
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-                    if (ichunkaccess != null || !flag) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+                    if (ichunkaccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                         return ichunkaccess;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 }
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -177,12 +187,12 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-20 09:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             if (playerchunk == null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 return null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             } else {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-                Either<IChunkAccess, PlayerChunk.Failure> either = (Either) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow((Object) null);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+                Either<IChunkAccess, PlayerChunk.Failure> either = (Either) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow(null); // CraftBukkit - decompile error
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-20 09:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 if (either == null) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                     return null;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-                    IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse((Object) null);
 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-02 11:18:17 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+                    IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse(null); // CraftBukkit - decompile error
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-20 09:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                     if (ichunkaccess1 != null) {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                         this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -230,7 +240,15 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         int l = ChunkLevel.byStatus(chunkstatus);
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-        if (flag) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // CraftBukkit start - don't add new ticket for currently unloading chunk
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        boolean currentlyUnloading = false;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        if (playerchunk != null) {
 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            FullChunkStatus oldChunkState = ChunkLevel.fullStatus(playerchunk.oldTicketLevel);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            FullChunkStatus currentChunkState = ChunkLevel.fullStatus(playerchunk.getTicketLevel());
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            currentlyUnloading = (oldChunkState.isOrAfter(FullChunkStatus.FULL) && !currentChunkState.isOrAfter(FullChunkStatus.FULL));
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        if (flag && !currentlyUnloading) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            // CraftBukkit end
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             if (this.chunkAbsent(playerchunk, l)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -249,7 +267,7 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
							 
						 
					
						
							
								
									
										
										
										
											2019-05-16 01:11:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-        return playerchunk == null || playerchunk.getTicketLevel() > i;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        return playerchunk == null || playerchunk.oldTicketLevel > i; // CraftBukkit using oldTicketLevel for isLoaded checks
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-25 10:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     @Override
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -317,7 +335,7 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         } else if (!this.level.shouldTickBlocksAt(i)) {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             return false;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         } else {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-            Either<Chunk, PlayerChunk.Failure> either = (Either) playerchunk.getTickingChunkFuture().getNow((Object) null);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            Either<Chunk, PlayerChunk.Failure> either = (Either) playerchunk.getTickingChunkFuture().getNow(null); // CraftBukkit - decompile error
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-25 10:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             return either != null && either.left().isPresent();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         }
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -330,11 +348,31 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-29 16:36:51 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     @Override
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     public void close() throws IOException {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-        this.save(true);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // CraftBukkit start
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        close(true);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    public void close(boolean save) throws IOException {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        if (save) {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            this.save(true);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // CraftBukkit end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         this.lightEngine.close();
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         this.chunkMap.close();
							 
						 
					
						
							
								
									
										
										
										
											2018-07-15 10:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 12:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+    // CraftBukkit start - modelled on below
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    public void purgeUnload() {
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        this.level.getProfiler().push("purge");
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        this.distanceManager.purgeStaleTickets();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        this.runDistanceManagerUpdates();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        this.level.getProfiler().popPush("unload");
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        this.chunkMap.tick(() -> true);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        this.level.getProfiler().pop();
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-28 06:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        this.clearCache();
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-26 12:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+    // CraftBukkit end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     @Override
							 
						 
					
						
							
								
									
										
										
										
											2022-03-01 02:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     public void tick(BooleanSupplier booleansupplier, boolean flag) {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         this.level.getProfiler().push("purge");
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -366,7 +404,7 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             gameprofilerfiller.push("pollingChunks");
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-            boolean flag1 = worlddata.getGameTime() % 400L == 0L;
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 18:47:27 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-14 10:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             gameprofilerfiller.push("naturalSpawnCount");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             int l = this.distanceManager.getNaturalSpawnChunkCount();
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -387,7 +425,7 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             }
							 
						 
					
						
							
								
									
										
										
										
											2021-07-07 00:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             gameprofilerfiller.popPush("spawnAndTick");
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-            boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+            boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.players().isEmpty(); // CraftBukkit
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-07 00:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             Collections.shuffle(list);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             Iterator iterator1 = list.iterator();
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 01:30:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								@@ -592,13 +630,19 @@
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								         }
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         @Override
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								-        protected boolean pollTask() {
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        public boolean pollTask() {
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        try {
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             if (ChunkProviderServer.this.runDistanceManagerUpdates()) {
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                 return true;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								             } else {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                 ChunkProviderServer.this.lightEngine.tryScheduleUpdate();
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                 return super.pollTask();
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								             }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        } finally {
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+            chunkMap.callbackExecutor.run();
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-13 20:19:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								+        }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								+        // CraftBukkit end
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								         }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     }
							 
						 
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00