Class PlayerInventorySlotChangeEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
io.papermc.paper.event.player.PlayerInventorySlotChangeEvent

public class PlayerInventorySlotChangeEvent extends PlayerEvent
Called when a slot contents change in a player's inventory.
  • Constructor Details

  • Method Details

    • getRawSlot

      public int getRawSlot()
      The raw slot number that was changed.
      Returns:
      The raw slot number.
    • getSlot

      public int getSlot()
      The slot number that was changed, ready for passing to Inventory.getItem(int). Note that there may be two slots with the same slot number, since a view links two different inventories.

      If no inventory is opened, internal crafting view is used for conversion.

      Returns:
      The slot number.
    • getOldItemStack

      @NotNull public @NotNull ItemStack getOldItemStack()
      Clone of ItemStack that was in the slot before the change.
      Returns:
      The old ItemStack in the slot.
    • getNewItemStack

      @NotNull public @NotNull ItemStack getNewItemStack()
      Clone of ItemStack that is in the slot after the change.
      Returns:
      The new ItemStack in the slot.
    • shouldTriggerAdvancements

      public boolean shouldTriggerAdvancements()
      Gets whether the slot change advancements will be triggered.
      Returns:
      Whether the slot change advancements will be triggered.
    • setShouldTriggerAdvancements

      public void setShouldTriggerAdvancements(boolean triggerAdvancements)
      Sets whether the slot change advancements will be triggered.
      Parameters:
      triggerAdvancements - Whether the slot change advancements will be triggered.
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()