Class PlayerSetItemStackEvent

java.lang.Object
net.minestom.server.event.Event
net.minestom.server.event.CancellableEvent
net.minestom.server.event.player.PlayerSetItemStackEvent

public class PlayerSetItemStackEvent
extends CancellableEvent
Called as a result of PlayerInventory.setItemStack(int, ItemStack) and player click in his inventory.
  • Constructor Summary

    Constructors 
    Constructor Description
    PlayerSetItemStackEvent​(Player player, int slot, ItemStack itemStack)  
  • Method Summary

    Modifier and Type Method Description
    ItemStack getItemStack()
    Gets the item stack which will be set.
    Player getPlayer()
    Gets the player who has an item stack set to his inventory.
    int getSlot()
    Gets the slot where the item will be set.
    void setItemStack​(ItemStack itemStack)
    Changes the item stack which will be set.
    void setSlot​(int slot)
    Changes the slot where the item will be set.

    Methods inherited from class net.minestom.server.event.CancellableEvent

    isCancelled, setCancelled

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getPlayer

      @NotNull public Player getPlayer()
      Gets the player who has an item stack set to his inventory.
      Returns:
      the player
    • getSlot

      public int getSlot()
      Gets the slot where the item will be set.
      Returns:
      the slot
    • setSlot

      public void setSlot​(int slot)
      Changes the slot where the item will be set.
      Parameters:
      slot - the new slot
    • getItemStack

      @NotNull public ItemStack getItemStack()
      Gets the item stack which will be set.
      Returns:
      the item stack
    • setItemStack

      public void setItemStack​(@NotNull ItemStack itemStack)
      Changes the item stack which will be set.
      Parameters:
      itemStack - the new item stack