Class PlayerUseSpecialItemEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerUseSpecialItemEvent
All Implemented Interfaces:
ArenaEvent, Cancellable

public class PlayerUseSpecialItemEvent extends PlayerEvent implements ArenaEvent, Cancellable
Gets called when a player is using a special item while he's in a game
  • Constructor Details

    • PlayerUseSpecialItemEvent

      public PlayerUseSpecialItemEvent(Player player, SpecialItem specialItem, Arena arena, ItemStack item, boolean isOffHand, @Nullable @Nullable Block clickedBlock, @Nullable @Nullable BlockFace clickedBlockFace, boolean takeItem)
  • Method Details

    • getSpecialItem

      public SpecialItem getSpecialItem()
      Returns the special item that the player has used.
      Returns:
      The special item that has been used
    • getArena

      public Arena getArena()
      Returns the arena in which the player has used the item.
      Specified by:
      getArena in interface ArenaEvent
      Returns:
      The arena involved in this
    • getItem

      public ItemStack getItem()
      Returns the item with which the player interacted.
      Returns:
      The item that the player right-clicked
    • isOffHand

      public boolean isOffHand()
      Returns whether the player used the item in his off-hand.

      This method always returns false on 1.8.8, as off-hand got added with 1.9.

      Returns:
      If the player used the item in his off-hand
    • getClickedBlock

      @Nullable public @Nullable Block getClickedBlock()
      Returns the block on which the player clicked.

      Can be null when the player used the item while looking to the sky or at an hologram.

      Returns:
      The block that has been clicked
    • getClickedBlockFace

      @Nullable public @Nullable BlockFace getClickedBlockFace()
      Returns the block face on which the player clicked.

      Can be null when the player used the item while looking to the sky or at an hologram.

      Returns:
      The block face on which he clicked
    • isTakingItem

      public boolean isTakingItem()
      Returns whether the item will be taken from the players inventory.
      Returns:
      If the item will be taken away
    • setTakingItem

      public void setTakingItem(boolean takeItem)
      Set whether the item should be taken away from the player.
      Parameters:
      takeItem - If the item shall be taken away
    • isNaturalInteractionCancelled

      public boolean isNaturalInteractionCancelled()
      Returns whether the plugin will accept the handling of the natural behaviour of whatever would actually happen.

      For instance, when holding a block, the player would (possibly) place the block. By default, the plugin returns true unless it has been changed using setNaturalInteractionCancelled(boolean).

      Returns:
      If the natural behaviour of the interaction will be processed
    • setNaturalInteractionCancelled

      public void setNaturalInteractionCancelled(boolean newState)
      Set whether the plugin should accept the handling of the natural behaviour of whatever would actually happen.

      For instance, when holding a block, the player would (possibly) place the block. By default, the plugin has set it to true.

      Parameters:
      newState - If the natural behaviour of the interaction shall be processed
    • getHandlers

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

      public static HandlerList getHandlerList()