Class ActionItem
- Since:
- 1.1.1
-
Constructor Summary
ConstructorDescriptionActionItem
(ItemStack itemStack, int slot, Consumer<InventoryClickEvent> onClick, Consumer<@Nullable ItemStack> onClose) Creates a new Action Item. -
Method Summary
Modifier and TypeMethodDescriptionint
getSlot()
void
This method will be called for the clicked item stack and only for the clicked item stack.void
onInventoryClose
(ItemStack itemStack) This method is called for each registered item stack individually when an inventory is closed.
-
Constructor Details
-
ActionItem
public ActionItem(ItemStack itemStack, int slot, Consumer<InventoryClickEvent> onClick, Consumer<@Nullable ItemStack> onClose) Creates a new Action Item. A action item will be passed to theInventoryActions
wrapper.The
itemStack
will be inserted at the givenslot
and will not leave this slot until the inventory is closed.- Parameters:
itemStack
- item for the actionslot
- position of the itemonClick
- This consumer will be called for the clicked item stack and only for the clicked item stack.It will be only called when the item stack is clicked and not when another item stack inside this inventory is clicked.
The click event will be canceled after forwarding it to the action item.
onClose
- This method is called for each registered item stack individually when an inventory is closed.The event will not be passed.
Use this method to save the settings.
-
-
Method Details
-
getItemStack
-
getSlot
public int getSlot() -
onInventoryClose
This method is called for each registered item stack individually when an inventory is closed.The event will not be passed.
Use this method to save the settings.
- Parameters:
itemStack
- item stack in the closed inventory.
-
onInventoryClick
This method will be called for the clicked item stack and only for the clicked item stack.It will be only called when the item stack is clicked and not when another item stack inside this inventory is clicked.
The click event will be canceled after forwarding it to the action item.
- Parameters:
event
- click event of the clicked item stack
-