Class PlayerSwapHandItemsEvent

java.lang.Object
fr.fidorial.event.player.PlayerSwapHandItemsEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class PlayerSwapHandItemsEvent extends Object implements PlayerEvent, Cancellable
Fired when a player swaps the items of their two hands.
Since:
0.1.0
  • Constructor Details

    • PlayerSwapHandItemsEvent

      public PlayerSwapHandItemsEvent(Player player, ItemStack mainHand, ItemStack offHand)
      Creates an event.
      Parameters:
      player - the player
      mainHand - what the main hand holds before the swap, ItemStack.EMPTY when nothing
      offHand - what the off hand holds before the swap, ItemStack.EMPTY when nothing
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • mainHand

      public ItemStack mainHand()
      Returns what the main hand holds before the swap, and the off hand after it.
      Returns:
      what the main hand holds before the swap, and the off hand after it
      Since:
      0.1.0
    • offHand

      public ItemStack offHand()
      Returns what the off hand holds before the swap, and the main hand after it.
      Returns:
      what the off hand holds before the swap, and the main hand after it
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it