java.lang.Object
me.deecaad.weaponmechanics.weapon.projectile.AProjectile
me.deecaad.weaponmechanics.weapon.projectile.weaponprojectile.WeaponProjectile

public class WeaponProjectile extends AProjectile
  • Constructor Details

    • WeaponProjectile

      public WeaponProjectile(ProjectileSettings projectileSettings, org.bukkit.entity.LivingEntity shooter, org.bukkit.Location location, org.bukkit.util.Vector motion, org.bukkit.inventory.ItemStack weaponStack, String weaponTitle, org.bukkit.inventory.EquipmentSlot hand, Sticky sticky, Through through, Bouncy bouncy)
  • Method Details

    • clone

      public WeaponProjectile clone(org.bukkit.Location location, org.bukkit.util.Vector motion)
      Clones the settings of this weapon projectile without shooting it
      Parameters:
      location - the cloned projectile's new start location
      motion - the cloned projectile's new motion
      Returns:
      the cloned projectile
    • getProjectileSettings

      public ProjectileSettings getProjectileSettings()
    • setProjectileSettings

      public void setProjectileSettings(@NotNull ProjectileSettings projectileSettings)
    • getSticky

      @Nullable public Sticky getSticky()
    • setSticky

      public void setSticky(@Nullable Sticky sticky)
    • setSticky

      public void setSticky(@Nullable Sticky sticky, boolean isStickyChanged)
      Sets the sticky properties of this projectile (whether it sticks to blocks/entities). If isStickyChanged == true, then no copy will be made. This means that the passed sticky instance must be mutable.
      Parameters:
      sticky - The nullable sticky instance.
      isStickyChanged - true if sticky is mutable.
    • getThrough

      @Nullable public Through getThrough()
    • setThrough

      public void setThrough(@Nullable Through through)
    • setThrough

      public void setThrough(@Nullable Through through, boolean isThroughChanged)
      Sets the through properties of this projectile (whether it passes through blocks/entities). If isThroughChanged == true, then no copy will be made. This means that the passed through instance must be mutable.
      Parameters:
      through - The nullable through instance.
      isThroughChanged - true if through is mutable.
    • getBouncy

      @Nullable public Bouncy getBouncy()
    • setBouncy

      public void setBouncy(@Nullable Bouncy bouncy)
    • setBouncy

      public void setBouncy(@Nullable Bouncy bouncy, boolean isBouncyChanged)
      Sets the bouncy properties of this projectile (whether it bounces on blocks/entities). If isBouncyChanged == true, then no copy will be made. This means that the passed through instance must be mutable.
      Parameters:
      bouncy - The nullable bouncy instance.
      isBouncyChanged - true if bouncy is mutable.
    • getGravity

      public double getGravity()
      Overrides:
      getGravity in class AProjectile
      Returns:
      gravity of projectile
    • getMinimumSpeed

      public double getMinimumSpeed()
      Description copied from class: AProjectile
      -1.0 means not used
      Overrides:
      getMinimumSpeed in class AProjectile
      Returns:
      minimum speed of projectile
    • isRemoveAtMinimumSpeed

      public boolean isRemoveAtMinimumSpeed()
      Overrides:
      isRemoveAtMinimumSpeed in class AProjectile
      Returns:
      whether to remove projectile when minimum speed is reached
    • getMaximumSpeed

      public double getMaximumSpeed()
      Description copied from class: AProjectile
      -1.0 means not used
      Overrides:
      getMaximumSpeed in class AProjectile
      Returns:
      maximum speed of projectile
    • isRemoveAtMaximumSpeed

      public boolean isRemoveAtMaximumSpeed()
      Overrides:
      isRemoveAtMaximumSpeed in class AProjectile
      Returns:
      whether to remove projectile when maximum speed is reached
    • getDrag

      public double getDrag()
      Overrides:
      getDrag in class AProjectile
      Returns:
      base speed decreasing
    • getMaximumAliveTicks

      public int getMaximumAliveTicks()
      Overrides:
      getMaximumAliveTicks in class AProjectile
      Returns:
      the maximum amount of ticks projectile can be alive
    • hasTravelledMaximumDistance

      public boolean hasTravelledMaximumDistance()
    • getWeaponStack

      @Nullable public org.bukkit.inventory.ItemStack getWeaponStack()
      Can be null if for example API is used to shoot this projectile.
      Returns:
      the item stack used to shoot this projectile
    • getWeaponTitle

      public String getWeaponTitle()
      Returns:
      the weapon title used to shoot this projectile
    • getHand

      public org.bukkit.inventory.EquipmentSlot getHand()
      Can be null through API
      Returns:
      the hand used to shoot this projectile.
    • getStickedData

      public StickedData getStickedData()
      Returns:
      the sticked data if this projectile is sticked to some entity or block
    • setStickedData

      public void setStickedData(StickedData stickedData)
      Set new sticked data. If new sticked data is null, sticked data is removed
      Parameters:
      stickedData - the new sticked data
    • getThroughAmount

      public double getThroughAmount()
      Returns:
      the amount of hit boxes this projectile has gone through using through feature
    • getBounces

      public int getBounces()
      Returns:
      the amount of hit boxes this projectile has bounced off using bouncy feature
    • setRolling

      public void setRolling(boolean rolling)
      Setting rolling to true disables projectile gravity
      Parameters:
      rolling - the new rolling state
    • isRolling

      public boolean isRolling()
      Returns:
      whether projectile is currently rolling
    • updatePosition

      public boolean updatePosition()
      Description copied from class: AProjectile
      This method updates the projectile's position/velocity, and handles all physics interactions during that movement. This method also updates AProjectile.distanceTravelled.
      Specified by:
      updatePosition in class AProjectile
      Returns:
      true if projectile should be removed from projectile runnable
    • onEnd

      public void onEnd()
      Description copied from class: AProjectile
      Override this method to do something on end
      Overrides:
      onEnd in class AProjectile