Class InventoryItemChangeEvent

java.lang.Object
net.minestom.server.event.inventory.InventoryItemChangeEvent
All Implemented Interfaces:
Event, InventoryEvent, RecursiveEvent
Direct Known Subclasses:
PlayerInventoryItemChangeEvent

public class InventoryItemChangeEvent extends Object implements InventoryEvent, RecursiveEvent
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 Details

    • InventoryItemChangeEvent

      public InventoryItemChangeEvent(@Nullable @Nullable Inventory inventory, int slot, @NotNull @NotNull ItemStack previousItem, @NotNull @NotNull ItemStack newItem)
  • Method Details

    • getSlot

      public int getSlot()
      Gets the changed slot number.
      Returns:
      the changed slot number.
    • getPreviousItem

      @NotNull public @NotNull ItemStack getPreviousItem()
      Gets a previous item that was on changed slot.
      Returns:
      a previous item that was on changed slot.
    • getNewItem

      @NotNull public @NotNull ItemStack getNewItem()
      Gets a new item on a changed slot.
      Returns:
      a new item on a changed slot.
    • getInventory

      @Nullable public @Nullable Inventory getInventory()
      Description copied from interface: InventoryEvent
      Gets the inventory.
      Specified by:
      getInventory in interface InventoryEvent
      Returns:
      the inventory, null if this is a player's inventory