From c91f460e420afb0574458c82e475d2d19d689272 Mon Sep 17 00:00:00 2001 From: Intelli Date: Thu, 4 Jan 2024 20:23:05 -0700 Subject: [PATCH] Fixed ConcurrentModificationException while using queueLookup API method (fixes #481) --- src/main/java/net/coreprotect/api/QueueLookup.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coreprotect/api/QueueLookup.java b/src/main/java/net/coreprotect/api/QueueLookup.java index 0ba41b6..6ba34aa 100644 --- a/src/main/java/net/coreprotect/api/QueueLookup.java +++ b/src/main/java/net/coreprotect/api/QueueLookup.java @@ -3,6 +3,7 @@ package net.coreprotect.api; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.ListIterator; import java.util.Map; import org.bukkit.Location; @@ -49,7 +50,9 @@ public class QueueLookup extends Queue { Map consumerObject = Consumer.consumerObjects.get(currentConsumer); Location oldLocation = block.getLocation(); - for (Object[] data : consumerData) { + ListIterator iterator = consumerData.listIterator(); + while (iterator.hasNext()) { + Object[] data = iterator.next(); int id = (int) data[0]; int action = (int) data[1]; if (action != Process.BLOCK_BREAK && action != Process.BLOCK_PLACE) {