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

public class WeaponFullAutoEvent extends WeaponEvent implements 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.

  • 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:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      @Deprecated public void setCancelled(boolean cancel)
      Deprecated.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable