Class WeaponEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
me.deecaad.weaponmechanics.weapon.weaponevents.WeaponEvent
- Direct Known Subclasses:
PrepareWeaponShootEvent,ProjectileEvent,WeaponDamageEntityEvent,WeaponEquipEvent,WeaponFirearmEvent,WeaponFullAutoEvent,WeaponGenerateEvent,WeaponKillEntityEvent,WeaponMeleeHitEvent,WeaponMeleeMissEvent,WeaponPostShootEvent,WeaponPreReloadEvent,WeaponPreShootEvent,WeaponRecoilEvent,WeaponReloadCancelEvent,WeaponReloadCompleteEvent,WeaponReloadEvent,WeaponScopeEvent,WeaponSelectiveFireChangeEvent,WeaponShootEvent,WeaponSkinEvent,WeaponStopShootingEvent
public abstract class WeaponEvent
extends org.bukkit.event.entity.EntityEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
FieldsFields inherited from class org.bukkit.event.entity.EntityEvent
entity -
Constructor Summary
ConstructorsConstructorDescriptionWeaponEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand) -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.EquipmentSlotgetHand()Returns the hand involved in the event.getHandData(boolean noAutoAdd) Helper method to theHandDatainvolved in this event.org.bukkit.entity.LivingEntityReturns the shooter involved in this event.getShooterWrapper(boolean noAutoAdd) org.bukkit.inventory.ItemStackReturns the weapon item which caused the event.Returns the weapon-title associated with the weapon involved.booleanReturnstrueif the weapon involved in this event was in the main hand.booleanReturnsfalseif the weapon involved in this event was in the main hand.Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntity, getEntityTypeMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, getHandlers, isAsynchronous
-
Field Details
-
weaponTitle
-
-
Constructor Details
-
WeaponEvent
public WeaponEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand)
-
-
Method Details
-
getWeaponTitle
Returns the weapon-title associated with the weapon involved. This is the same as`CustomTag.WEAPON_TITLE.getString(event.getWeaponStack())`.- Returns:
- The non-null weapon title.
-
getWeaponStack
public org.bukkit.inventory.ItemStack getWeaponStack()Returns the weapon item which caused the event. This should always be an item in the player's main hand, or off hand.- Returns:
- The non-null weapon item.
-
getShooter
@NotNull public org.bukkit.entity.LivingEntity getShooter()Returns the shooter involved in this event. This is the same asEntityEvent.getEntity()but without the added overhead from casting it to aLivingEntity.- Returns:
- The non-null entity that fired the weapon. This will not always be a player!
-
getHand
@Nullable public org.bukkit.inventory.EquipmentSlot getHand()Returns the hand involved in the event. WeaponMechanics will only ever set this toEquipmentSlot.HANDorEquipmentSlot.OFF_HAND(Other plugins may change that). This value will benullwhen no hand was involved (Some explosions and some API methods).- Returns:
- The nullable hand involved.
- See Also:
-
isMainHand
public boolean isMainHand()Returnstrueif the weapon involved in this event was in the main hand.falsemeans the weapon was in the offhand.- Returns:
- true if weapon is in main hand.
-
isOffHand
public boolean isOffHand()Returnsfalseif the weapon involved in this event was in the main hand.truemeans the weapon was in the offhand.- Returns:
- true if weapon is in offhand.
-
getHandData
Helper method to theHandDatainvolved in this event. For player shooters, the returned value will never be null. For entities, the value might be null.- Returns:
- The nullable hand data involved.
-
getShooterWrapper
-