Class ArmorEquipEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.jeff_media.armorequipevent.ArmorEquipEvent
All Implemented Interfaces:
Cancellable

public final class ArmorEquipEvent extends PlayerEvent implements Cancellable
Called when a player equips or unequips a piece of armor.
Since:
Jul 30, 2015
Author:
Arnah
  • Constructor Details

    • ArmorEquipEvent

      public ArmorEquipEvent(Player player, ArmorEquipEvent.EquipMethod equipType, ArmorType type, ItemStack oldArmorPiece, ItemStack newArmorPiece)
      Creates a new ArmorEquipEvent
      Parameters:
      player - The player who put on / removed the armor.
      type - The ArmorType of the armor added
      oldArmorPiece - The ItemStack of the armor removed.
      newArmorPiece - The ItemStack of the armor added.
  • Method Details

    • registerListener

      public static void registerListener(JavaPlugin plugin)
      Registers the listeners for this event. If you forget to call this method, then the event will never get caled.
      Parameters:
      plugin - Plugin to call this event from
    • getHandlerList

      public static HandlerList getHandlerList()
      Gets a list of handlers handling this event.
      Returns:
      A list of handlers handling this event.
    • getHandlers

      public final HandlerList getHandlers()
      Gets a list of handlers handling this event.
      Specified by:
      getHandlers in class Event
      Returns:
      A list of handlers handling this event.
    • setCancelled

      public final void setCancelled(boolean cancel)
      Sets if this event should be cancelled.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - If this event should be cancelled. When the event is cancelled, the armor is not changed.
    • isCancelled

      public final boolean isCancelled()
      Gets if this event is cancelled.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      If this event is cancelled
    • getType

      public final ArmorType getType()
      Returns the type of armor involved in this event
      Returns:
      ArmorType
    • getOldArmorPiece

      public final ItemStack getOldArmorPiece()
      Returns the last equipped armor piece, could be a piece of armor, or null
    • setOldArmorPiece

      public final void setOldArmorPiece(ItemStack oldArmorPiece)
    • getNewArmorPiece

      Returns the newly equipped armor or null if the armor was unequipped
      Returns:
      ItemStack of armor or null
    • setNewArmorPiece

      public final void setNewArmorPiece(@Nullable ItemStack newArmorPiece)
      Sets the new armor piece
      Parameters:
      newArmorPiece - The new armor piece
    • getMethod

      Gets the method used to either equip or unequip an armor piece.