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 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 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(EntityWrapper shooter, String weaponTitle, boolean mainhand)
      Gets the location to shoot from.

      The returned location will have its direction set to the desired shoot direction. For VR players, this will be the hand direction.

      Parameters:
      shooter - the entity that is shooting
      weaponTitle - the weapon title
      mainhand - whether the shooter is shooting from their mainhand
      Returns:
      the location to shoot from
    • 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