removeItemSafely

fun Inventory.removeItemSafely(material: Material, amount: Int): Boolean

Safely removes the specified amount of items of the given material from this inventory.

This method only removes items if the inventory contains enough of the specified material. It iterates through inventory slots and removes items until the specified amount is removed.

Return

true if the items were successfully removed, false if there were not enough items

Parameters

material

The material type to remove

amount

The amount to remove