public class InventoryItemRemover
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private org.bukkit.inventory.Inventory |
inventory
The inventory, to count and remove items from.
|
private java.util.Map<java.lang.String,java.lang.Integer> |
itemNameAmountMap
A map of the amounts to remove, indexed by item name.
|
| Constructor and Description |
|---|
InventoryItemRemover(org.bukkit.inventory.Inventory inventory)
Creates a new inventory item remover for the given inventory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItemNameToRemove(java.lang.String itemName,
java.lang.Integer itemAmount)
Adds an item to remove from the inventory.
|
org.bukkit.inventory.Inventory |
execute()
Removes all the registered items from the inventory.
|
private void |
findAndRemoveItems(java.lang.String itemName,
java.lang.Integer itemAmount)
Removes the given amount of the given item from the inventory.
|
private java.lang.Integer |
removeItemsGetRemaining(org.bukkit.inventory.ItemStack itemStack,
java.lang.Integer itemAmount)
Removes items from a stack, till the stack is empty or the given amount is reached.
|
private org.bukkit.inventory.Inventory inventory
private java.util.Map<java.lang.String,java.lang.Integer> itemNameAmountMap
public InventoryItemRemover(org.bukkit.inventory.Inventory inventory)
inventory - The inventory, to count and remove items from.public void addItemNameToRemove(java.lang.String itemName,
java.lang.Integer itemAmount)
itemName - The name of the item.itemAmount - The amount to remove.public org.bukkit.inventory.Inventory execute()
findAndRemoveItems(String, Integer)private void findAndRemoveItems(java.lang.String itemName,
java.lang.Integer itemAmount)
itemName - The name of the item.itemAmount - The amount to remove.removeItemsGetRemaining(ItemStack, Integer)private java.lang.Integer removeItemsGetRemaining(org.bukkit.inventory.ItemStack itemStack,
java.lang.Integer itemAmount)
itemStack - The item stack to remove from.itemAmount - The amount to remove.