Skip to content

Commit c91f460

Browse files
committed
Fixed ConcurrentModificationException while using queueLookup API method (fixes #481)
1 parent 7424037 commit c91f460

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/net/coreprotect/api/QueueLookup.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.Collections;
55
import java.util.List;
6+
import java.util.ListIterator;
67
import java.util.Map;
78

89
import org.bukkit.Location;
@@ -49,7 +50,9 @@ public static List<String[]> performLookup(Block block) {
4950
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(currentConsumer);
5051

5152
Location oldLocation = block.getLocation();
52-
for (Object[] data : consumerData) {
53+
ListIterator<Object[]> iterator = consumerData.listIterator();
54+
while (iterator.hasNext()) {
55+
Object[] data = iterator.next();
5356
int id = (int) data[0];
5457
int action = (int) data[1];
5558
if (action != Process.BLOCK_BREAK && action != Process.BLOCK_PLACE) {

0 commit comments

Comments
 (0)