Class WeaponFullAutoEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
me.deecaad.weaponmechanics.weapon.weaponevents.WeaponEvent
me.deecaad.weaponmechanics.weapon.weaponevents.WeaponFullAutoEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Called before an attempt to use Full Auto. This event is called for all types of weapons,
including semi, burst, AND auto. However, for semi and burst, shotsPerSecond will be 0 (and thus
the event will be cancelled).
Note that all changes are kept until the task is cancelled. This means that changes are
semi-permanent. If you want to change the full-auto rate of a current gun, you should get
the FullAutoTask from an entity's hand data.
If you want to "reset" the rate later, you should call this event so other plugins, like WeaponMechanicsPlus, can modify the fire rate again.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
Fields inherited from class me.deecaad.weaponmechanics.weapon.weaponevents.WeaponEvent
weaponTitleFields inherited from class org.bukkit.event.entity.EntityEvent
entity -
Constructor Summary
ConstructorsConstructorDescriptionWeaponFullAutoEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand, int shotsPerSecond) -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.event.HandlerListorg.bukkit.event.HandlerListintGets the rate of fire in shots per second.booleanvoidsetCancelled(boolean cancel) Deprecated.voidsetShotsPerSecond(int shotsPerSecond) Sets the rate of fire in shots per second.Methods inherited from class me.deecaad.weaponmechanics.weapon.weaponevents.WeaponEvent
getHand, getHandData, getShooter, getShooterWrapper, getWeaponStack, getWeaponTitle, isMainHand, isOffHandMethods inherited from class org.bukkit.event.entity.EntityEvent
getEntity, getEntityTypeMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
WeaponFullAutoEvent
public WeaponFullAutoEvent(String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.entity.LivingEntity shooter, org.bukkit.inventory.EquipmentSlot hand, int shotsPerSecond)
-
-
Method Details
-
getShotsPerSecond
public int getShotsPerSecond()Gets the rate of fire in shots per second. This is the number of shots that will be fired every second. For example, if this value is 2, then 2 shots will be fired every second.For semi and burst weapons, this value will be 0. A typical full auto weapon will use values 1-20, but can be any integer.
- Returns:
- the rate of fire in shots per second
-
setShotsPerSecond
public void setShotsPerSecond(int shotsPerSecond) Sets the rate of fire in shots per second. This is the number of shots that will be fired every second. For example, if this value is 2, then 2 shots will be fired every second.If you set this value to 0, the full auto attempt will be cancelled, and the handler will try to use burst/semi.
- Parameters:
shotsPerSecond- the rate of fire in shots per second
-
getHandlers
@NotNull public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList() -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
Deprecated.- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-