Package com.jeff_media.armorequipevent
Class ArmorEquipEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.jeff_media.armorequipevent.ArmorEquipEvent
- All Implemented Interfaces:
Cancellable
Called when a player equips or unequips a piece of armor.
- Since:
- Jul 30, 2015
- Author:
- Arnah
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the way of equipping or uneqipping armor.Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionArmorEquipEvent(Player player, ArmorEquipEvent.EquipMethod equipType, ArmorType type, ItemStack oldArmorPiece, ItemStack newArmorPiece) Creates a new ArmorEquipEvent -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListGets a list of handlers handling this event.final HandlerListGets a list of handlers handling this event.Gets the method used to either equip or unequip an armor piece.final ItemStackReturns the newly equipped armor or null if the armor was unequippedfinal ItemStackReturns the last equipped armor piece, could be a piece of armor, or nullfinal ArmorTypegetType()Returns the type of armor involved in this eventfinal booleanGets if this event is cancelled.static voidregisterListener(JavaPlugin plugin) Registers the listeners for this event.final voidsetCancelled(boolean cancel) Sets if this event should be cancelled.final voidsetNewArmorPiece(ItemStack newArmorPiece) Sets the new armor piecefinal voidsetOldArmorPiece(ItemStack oldArmorPiece) Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
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 addedoldArmorPiece- The ItemStack of the armor removed.newArmorPiece- The ItemStack of the armor added.
-
-
Method Details
-
registerListener
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
Gets a list of handlers handling this event.- Returns:
- A list of handlers handling this event.
-
getHandlers
Gets a list of handlers handling this event.- Specified by:
getHandlersin classEvent- Returns:
- A list of handlers handling this event.
-
setCancelled
Sets if this event should be cancelled.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- If this event should be cancelled. When the event is cancelled, the armor is not changed.
-
isCancelled
Gets if this event is cancelled.- Specified by:
isCancelledin interfaceCancellable- Returns:
- If this event is cancelled
-
getType
Returns the type of armor involved in this event- Returns:
- ArmorType
-
getOldArmorPiece
Returns the last equipped armor piece, could be a piece of armor, or null -
setOldArmorPiece
-
getNewArmorPiece
Returns the newly equipped armor or null if the armor was unequipped- Returns:
- ItemStack of armor or null
-
setNewArmorPiece
Sets the new armor piece- Parameters:
newArmorPiece- The new armor piece
-
getMethod
Gets the method used to either equip or unequip an armor piece.
-