Class ShootHandler

java.lang.Object
me.deecaad.weaponmechanics.weapon.shoot.ShootHandler
All Implemented Interfaces:
me.deecaad.core.file.IValidator, TriggerListener

public class ShootHandler extends Object implements me.deecaad.core.file.IValidator, TriggerListener
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ShootHandler(WeaponHandler weaponHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Mostly this is defaulted to false.
    void
    doShootFirearmActions(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, HandData handData, org.bukkit.inventory.EquipmentSlot slot)
     
     
     
    org.bukkit.Location
    getShootLocation(org.bukkit.entity.LivingEntity livingEntity, boolean dualWield, boolean mainhand)
    Get the shoot location based on dual wield and main hand
    boolean
    handleConsumeItemOnShoot(org.bukkit.inventory.ItemStack weaponStack, HandData handData)
    Removes one from the amount of weapon stack.
    boolean
    keepFullAutoOn(EntityWrapper entityWrapper, TriggerType triggerType, Trigger trigger)
    Checks whether to keep full auto on with given trigger
    void
    shoot(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.Location shootLocation, boolean mainHand, boolean updateSpreadChange, boolean isMelee)
    Shoots using weapon.
    void
    shoot(org.bukkit.entity.LivingEntity livingEntity, String weaponTitle, org.bukkit.util.Vector normalizedDirection)
    Shoots using weapon.
    boolean
    shootWithoutTrigger(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield)
     
    void
    startReloadIfBothWeaponsEmpty(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, boolean dualWield, boolean isReloadLoop)
     
    boolean
    tryUse(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield, @Nullable org.bukkit.entity.LivingEntity knownVictim)
    Tries to use given trigger type to trigger some action.
    void
    validate(me.deecaad.core.file.Configuration configuration, me.deecaad.core.file.SerializeData data)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.deecaad.core.file.IValidator

    denyKeys, shouldValidate
  • Constructor Details

    • ShootHandler

      public ShootHandler()
    • ShootHandler

      public ShootHandler(WeaponHandler weaponHandler)
  • Method Details

    • allowOtherTriggers

      public boolean allowOtherTriggers()
      Description copied from interface: TriggerListener
      Mostly this is defaulted to false.
      Specified by:
      allowOtherTriggers in interface TriggerListener
      Returns:
      true if other triggers can occur even after this trigger is valid
    • tryUse

      public boolean tryUse(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield, @Nullable @Nullable org.bukkit.entity.LivingEntity knownVictim)
      Description copied from interface: TriggerListener
      Tries to use given trigger type to trigger some action.
      Specified by:
      tryUse in interface TriggerListener
      Parameters:
      entityWrapper - the entity which caused trigger
      weaponTitle - the weapon title involved
      weaponStack - the weapon stack involved
      slot - the weapon slot used
      triggerType - the trigger which caused this
      dualWield - whether this was dual wield
      knownVictim - if there is known victim
      Returns:
      true if was able to use
    • shootWithoutTrigger

      public boolean shootWithoutTrigger(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, TriggerType triggerType, boolean dualWield)
      Returns:
      true if was able to shoot
    • doShootFirearmActions

      public void doShootFirearmActions(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, HandData handData, org.bukkit.inventory.EquipmentSlot slot)
    • keepFullAutoOn

      public boolean keepFullAutoOn(EntityWrapper entityWrapper, TriggerType triggerType, Trigger trigger)
      Checks whether to keep full auto on with given trigger
    • startReloadIfBothWeaponsEmpty

      public void startReloadIfBothWeaponsEmpty(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.inventory.EquipmentSlot slot, boolean dualWield, boolean isReloadLoop)
    • shoot

      public void shoot(EntityWrapper entityWrapper, String weaponTitle, org.bukkit.inventory.ItemStack weaponStack, org.bukkit.Location shootLocation, boolean mainHand, boolean updateSpreadChange, boolean isMelee)
      Shoots using weapon. Does not use ammo nor check for it.
    • shoot

      public void shoot(org.bukkit.entity.LivingEntity livingEntity, String weaponTitle, org.bukkit.util.Vector normalizedDirection)
      Shoots using weapon. Does not use ammo nor check for it. Does not apply recoil nor anything that would require EntityWrapper.
    • handleConsumeItemOnShoot

      public boolean handleConsumeItemOnShoot(org.bukkit.inventory.ItemStack weaponStack, HandData handData)
      Removes one from the amount of weapon stack. If stack is now empty also cancels all hand tasks.
      Parameters:
      weaponStack - the weapon stack
      Returns:
      true if weapon stack amount is now 0
    • getShootLocation

      public org.bukkit.Location getShootLocation(org.bukkit.entity.LivingEntity livingEntity, boolean dualWield, boolean mainhand)
      Get the shoot location based on dual wield and main hand
    • getKeyword

      public String getKeyword()
      Specified by:
      getKeyword in interface me.deecaad.core.file.IValidator
    • getAllowedPaths

      public List<String> getAllowedPaths()
      Specified by:
      getAllowedPaths in interface me.deecaad.core.file.IValidator
    • validate

      public void validate(me.deecaad.core.file.Configuration configuration, me.deecaad.core.file.SerializeData data) throws me.deecaad.core.file.SerializerException
      Specified by:
      validate in interface me.deecaad.core.file.IValidator
      Throws:
      me.deecaad.core.file.SerializerException