Class InventoryItemChangeEvent

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

public class InventoryItemChangeEvent extends Object implements InventoryEvent, RecursiveEvent
Called when AbstractInventory.setItemStack(int, ItemStack) is being invoked. This event cannot be cancelled and items related to the change are already moved.
  • Constructor Details

    • InventoryItemChangeEvent

      public InventoryItemChangeEvent(@NotNull @NotNull AbstractInventory 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

      @NotNull public @NotNull AbstractInventory getInventory()
      Description copied from interface: InventoryEvent
      Gets the inventory that was clicked.
      Specified by:
      getInventory in interface InventoryEvent