From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 29 May 2019 04:01:22 +0100 Subject: [PATCH] ChunkMapDistance CME diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java index ae661297774f51c8b61fc08ca43e13ba368d0021..0244768f76d83af427a07bd235c9bcec8ad5429e 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -33,7 +33,7 @@ public abstract class ChunkMapDistance { private final ChunkMapDistance.a e = new ChunkMapDistance.a(); private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); - private final Set pendingChunkUpdates = Sets.newHashSet(); + private final java.util.Queue pendingChunkUpdates = new java.util.LinkedList<>(); // PAIL pendingChunkUpdates // Paper - use a queue private final ChunkTaskQueueSorter i; private final Mailbox> j; private final Mailbox k; @@ -94,26 +94,12 @@ public abstract class ChunkMapDistance { ; } + // Paper start if (!this.pendingChunkUpdates.isEmpty()) { - // CraftBukkit start - // Iterate pending chunk updates with protection against concurrent modification exceptions - java.util.Iterator iter = this.pendingChunkUpdates.iterator(); - int expectedSize = this.pendingChunkUpdates.size(); - do { - PlayerChunk playerchunk = iter.next(); - iter.remove(); - expectedSize--; - - playerchunk.a(playerchunkmap); - - // Reset iterator if set was modified using add() - if (this.pendingChunkUpdates.size() != expectedSize) { - expectedSize = this.pendingChunkUpdates.size(); - iter = this.pendingChunkUpdates.iterator(); - } - } while (iter.hasNext()); - // CraftBukkit end - + while(!this.pendingChunkUpdates.isEmpty()) { + this.pendingChunkUpdates.remove().a(playerchunkmap); + } + // Paper end return true; } else { if (!this.l.isEmpty()) {