fixed ConcurrentModificationException in clear()

This commit is contained in:
Johannes Schmelz 2024-10-05 20:53:07 +02:00
parent e343074240
commit 62421e87cc

View File

@ -105,9 +105,8 @@ public class ShipMap {
* Removes all items from the map and triggers corresponding removal events for each.
*/
public void clear() {
for (Item item : items) {
items.remove(item);
notifyListeners(new ItemRemovedEvent(item, this));
while (!items.isEmpty()) {
notifyListeners(new ItemRemovedEvent(items.removeFirst(), this));
}
}