Class PlayerChangeHeldSlotEvent

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

public class PlayerChangeHeldSlotEvent
extends CancellableEvent
Called when a player change his held slot (by pressing 1-9 keys).
  • Constructor Summary

    Constructors 
    Constructor Description
    PlayerChangeHeldSlotEvent​(Player player, byte slot)  
  • Method Summary

    Modifier and Type Method Description
    Player getPlayer()
    Gets the player who changed his held slot.
    byte getSlot()
    Gets the slot which the player will held.
    void setSlot​(byte slot)
    Changes the final held slot of the player.

    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 changed his held slot.
      Returns:
      the player
    • getSlot

      public byte getSlot()
      Gets the slot which the player will held.
      Returns:
      the held slot
    • setSlot

      public void setSlot​(byte slot)
      Changes the final held slot of the player.
      Parameters:
      slot - the new held slot
      Throws:
      java.lang.IllegalArgumentException - if slot is not between 0 and 8