Fix Async Chunk Load Callback if chunk was already loaded

Fixes ACL API mainly, but might fix other smaller things too

Also improved the high priority check if the chunk was already marked done
This commit is contained in:
Aikar
2018-10-01 01:00:09 -04:00
parent 065868036c
commit e7ff2c2126
3 changed files with 18 additions and 14 deletions

View File

@@ -99,7 +99,7 @@ index 2d10f4aa37..719d5deb2c 100644
this.chunkScheduler.a(booleansupplier);
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index ac0e90eeca..abf5a7554d 100644
index ac0e90eeca..2fd8fa30ee 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -0,0 +0,0 @@ public class PlayerChunk {
@@ -114,13 +114,13 @@ index ac0e90eeca..abf5a7554d 100644
+ if (chunk == null) {
+ return;
+ }
+ if (!chunkHasPlayers) {
+ if (chunkHasPlayers) {
+ chunk.scheduledForUnload = null;
+ } else if (chunk.scheduledForUnload == null) {
+ chunk.scheduledForUnload = System.currentTimeMillis();
+ }
+ }
+ private boolean chunkHasPlayers = true;
+ private boolean chunkHasPlayers = false;
+ // Paper end
// CraftBukkit end
@@ -137,7 +137,7 @@ index ac0e90eeca..abf5a7554d 100644
} else {
if (this.c.isEmpty()) {
this.i = this.playerChunkMap.getWorld().getTime();
+ chunkHasPlayers = false; // Paper - delay chunk unloads
+ chunkHasPlayers = true; // Paper - delay chunk unloads
+ markChunkUsed(); // Paper - delay chunk unloads
}
@@ -146,7 +146,7 @@ index ac0e90eeca..abf5a7554d 100644
this.c.remove(entityplayer);
if (this.c.isEmpty()) {
+ chunkHasPlayers = true; // Paper - delay chunk unloads
+ chunkHasPlayers = false; // Paper - delay chunk unloads
+ markChunkUsed(); // Paper - delay chunk unloads
this.playerChunkMap.b(this);
}