From 796eb15a5bd6ee0a8a60df131ecca0a83e6c94bd Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 22 Mar 2020 20:02:22 +1100 Subject: [PATCH] #644: Fix ChunkMapDistance#removeAllTicketsFor not propagating ticket level updates Now call the method used in removeTicket for propagating the change, so that chunks are guaranteed to unload --- nms-patches/ChunkMapDistance.patch | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nms-patches/ChunkMapDistance.patch b/nms-patches/ChunkMapDistance.patch index 8477d9a903..19f20b0c91 100644 --- a/nms-patches/ChunkMapDistance.patch +++ b/nms-patches/ChunkMapDistance.patch @@ -110,7 +110,7 @@ } public void addTicket(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -@@ -251,6 +281,21 @@ +@@ -251,6 +281,26 @@ return this.i.a(); } @@ -118,12 +118,17 @@ + public void removeAllTicketsFor(TicketType ticketType, int ticketLevel, T ticketIdentifier) { + Ticket target = new Ticket<>(ticketType, ticketLevel, ticketIdentifier); + -+ for (java.util.Iterator>> iterator = this.tickets.values().iterator(); iterator.hasNext();) { -+ ArraySetSorted> tickets = iterator.next(); -+ tickets.remove(target); ++ for (java.util.Iterator>>> iterator = this.tickets.long2ObjectEntrySet().fastIterator(); iterator.hasNext();) { ++ Entry>> entry = iterator.next(); ++ ArraySetSorted> tickets = entry.getValue(); ++ if (tickets.remove(target)) { ++ // copied from removeTicket ++ this.e.b(entry.getLongKey(), a(tickets), false); // PAIL ticketLevelTracker // PAIL update // PAIL getLowestTicketLevel + -+ if (tickets.isEmpty()) { -+ iterator.remove(); ++ // can't use entry after it's removed ++ if (tickets.isEmpty()) { ++ iterator.remove(); ++ } + } + } + } @@ -132,7 +137,7 @@ class a extends ChunkMap { public a() { -@@ -331,13 +376,13 @@ +@@ -331,13 +381,13 @@ Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i)); if (flag1) { @@ -148,7 +153,7 @@ }, i, false)); } -@@ -346,7 +391,7 @@ +@@ -346,7 +396,7 @@ return j; })); } else {