Fix ConcurrentModificationException (issue #12 )

This commit is contained in:
bluefireoly
2021-01-29 13:44:02 +01:00
parent 11407b5ae3
commit 0961f25a3c

View File

@@ -3,7 +3,10 @@ package net.axay.kspigot.extensions.bukkit
import org.bukkit.event.inventory.InventoryAction
import org.bukkit.inventory.Inventory
fun Inventory.closeForViewers() = viewers.forEach { it.closeInventory() }
/**
* Closes the inventory for all viewers.
*/
fun Inventory.closeForViewers() = HashSet(viewers).forEach { it.closeInventory() }
/**
* @return True, if the action was a simple inventory click.
@@ -15,4 +18,4 @@ val InventoryAction.isSimple
InventoryAction.PICKUP_ALL, InventoryAction.PICKUP_HALF, InventoryAction.PICKUP_ONE
-> true
else -> false
}
}