Class InventoryItemChangeEvent
java.lang.Object
net.minestom.server.event.inventory.InventoryItemChangeEvent
- All Implemented Interfaces:
Event
,InventoryEvent
,RecursiveEvent
- Direct Known Subclasses:
PlayerInventoryItemChangeEvent
Called when
AbstractInventory.safeItemInsert(int, ItemStack)
is being invoked.
This event cannot be cancelled and items related to the change are already moved.- See Also:
-
Constructor Summary
ConstructorDescriptionInventoryItemChangeEvent
(@Nullable Inventory inventory, int slot, @NotNull ItemStack previousItem, @NotNull ItemStack newItem) -
Method Summary
-
Constructor Details
-
InventoryItemChangeEvent
-
-
Method Details
-
getSlot
public int getSlot()Gets the changed slot number.- Returns:
- the changed slot number.
-
getPreviousItem
Gets a previous item that was on changed slot.- Returns:
- a previous item that was on changed slot.
-
getNewItem
Gets a new item on a changed slot.- Returns:
- a new item on a changed slot.
-
getInventory
Description copied from interface:InventoryEvent
Gets the inventory.- Specified by:
getInventory
in interfaceInventoryEvent
- Returns:
- the inventory, null if this is a player's inventory
-