Fix Chunks unloading immediately for priority access - Fixes #3461

Adding a priority ticket was apparently causing the level tracker
to immediately unload the chunk.

That code is scary
This commit is contained in:
Aikar 2020-05-28 22:57:27 -04:00
parent 8e9b42b127
commit 0ef7812813

View File

@ -133,11 +133,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ticket1.a(this.currentTick);
- if (ticket.b() < j) {
+ if (ticket.getTicketLevel() < j || ticket.getTicketType() == TicketType.URGENT || (ticket.getTicketType() == TicketType.PRIORITY && ticket.getTicketLevel() - ticket.priority < j)) { // Paper - check priority tickets too
+ if (ticket.getTicketLevel() < j) {
this.e.b(i, ticket.b(), true);
+ // Paper start - queue update if priority ticket add
+ } else if (ticket.getTicketType() == TicketType.URGENT || ticket.getTicketType() == TicketType.PRIORITY) {
+ PlayerChunk updatingChunk = chunkMap.getUpdatingChunk(i);
+ if (updatingChunk != null) {
+ pendingChunkUpdates.add(updatingChunk);
+ }
+ // Paper end
}
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
return ticket == ticket1; // CraftBukkit
}
private boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean