Fixed ConcurrentModificationException while using queueLookup API method (fixes #481)

This commit is contained in:
Intelli 2024-01-04 20:23:05 -07:00
parent 7424037795
commit c91f460e42
1 changed files with 4 additions and 1 deletions

View File

@ -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<Integer, Object> consumerObject = Consumer.consumerObjects.get(currentConsumer);
Location oldLocation = block.getLocation();
for (Object[] data : consumerData) {
ListIterator<Object[]> 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) {