Skip to content

Commit

Permalink
Fixed ConcurrentModificationException while using queueLookup API met…
Browse files Browse the repository at this point in the history
…hod (fixes #481)
  • Loading branch information
Intelli committed Jan 5, 2024
1 parent 7424037 commit c91f460
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/net/coreprotect/api/QueueLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

import org.bukkit.Location;
Expand Down Expand Up @@ -49,7 +50,9 @@ public static List<String[]> performLookup(Block block) {
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) {
Expand Down

0 comments on commit c91f460

Please sign in to comment.