Package com.sucy.skill.api.projectile
Class ParticleProjectile
java.lang.Object
org.bukkit.scheduler.BukkitRunnable
com.sucy.skill.api.projectile.CustomProjectile
com.sucy.skill.api.projectile.ParticleProjectile
- All Implemented Interfaces:
Followable,Runnable,org.bukkit.metadata.Metadatable
A fake projectile that plays particles along its path
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParticleProjectile(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location loc, Settings settings, int lifespan) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected org.bukkit.event.Eventexpire()Handles expiring due to range or leaving loaded chunksprotected doubleorg.bukkit.LocationRetrieves the location of the projectileorg.bukkit.util.Vectorprotected org.bukkit.event.Eventhit(org.bukkit.entity.LivingEntity entity) Handles hitting an entityprotected org.bukkit.event.Eventland()Handles landing on terrainprotected booleanlanded()static ArrayList<ParticleProjectile>rain(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location center, Settings settings, double radius, double height, int amount, ProjectileCallback callback, int lifespan) Fires a spread of projectiles from the location.voidrun()Updates the projectiles position and checks for collisionsvoidsetVelocity(org.bukkit.util.Vector vel) Sets the velocity of the projectilestatic ArrayList<ParticleProjectile>spread(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.util.Vector center, org.bukkit.Location loc, Settings settings, double angle, int amount, ProjectileCallback callback, int lifespan) Fires a spread of projectiles from the location.voidteleport(org.bukkit.Location loc) Teleports the projectile to a locationMethods inherited from class com.sucy.skill.api.projectile.CustomProjectile
applyLanded, calcRain, calcSpread, cancel, checkCollision, getMetadata, getShooter, hasMetadata, isTraveling, isValid, removeMetadata, setAllyEnemy, setCallback, setMetadataMethods inherited from class org.bukkit.scheduler.BukkitRunnable
getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously
-
Field Details
-
SPEED
Settings key for the projectile speed- See Also:
-
-
Constructor Details
-
ParticleProjectile
public ParticleProjectile(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location loc, Settings settings, int lifespan) Constructor- Parameters:
shooter- entity that shot the projectilelevel- level to use for scaling the speedloc- initial location of the projectilesettings- settings for the projectile
-
-
Method Details
-
getLocation
public org.bukkit.Location getLocation()Retrieves the location of the projectile- Specified by:
getLocationin interfaceFollowable- Specified by:
getLocationin classCustomProjectile- Returns:
- location of the projectile
-
expire
protected org.bukkit.event.Event expire()Handles expiring due to range or leaving loaded chunks- Specified by:
expirein classCustomProjectile
-
land
protected org.bukkit.event.Event land()Handles landing on terrain- Specified by:
landin classCustomProjectile
-
hit
protected org.bukkit.event.Event hit(org.bukkit.entity.LivingEntity entity) Handles hitting an entity- Specified by:
hitin classCustomProjectile- Parameters:
entity- entity the projectile hit
-
landed
protected boolean landed()- Specified by:
landedin classCustomProjectile- Returns:
- true if passing through a solid block, false otherwise
-
getCollisionRadius
protected double getCollisionRadius()- Specified by:
getCollisionRadiusin classCustomProjectile- Returns:
- squared radius for colliding
-
getVelocity
public org.bukkit.util.Vector getVelocity()- Specified by:
getVelocityin classCustomProjectile- Returns:
- velocity of the projectile
-
teleport
public void teleport(org.bukkit.Location loc) Teleports the projectile to a location- Parameters:
loc- location to teleport to
-
setVelocity
public void setVelocity(org.bukkit.util.Vector vel) Sets the velocity of the projectile- Specified by:
setVelocityin classCustomProjectile- Parameters:
vel- new velocity
-
run
public void run()Updates the projectiles position and checks for collisions -
spread
public static ArrayList<ParticleProjectile> spread(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.util.Vector center, org.bukkit.Location loc, Settings settings, double angle, int amount, ProjectileCallback callback, int lifespan) Fires a spread of projectiles from the location.- Parameters:
shooter- entity shooting the projectileslevel- level to use for scaling the speedcenter- the center direction of the spreadloc- location to shoot fromsettings- settings to use when firingangle- angle of the spreadamount- number of projectiles to firecallback- optional callback for when projectiles hit- Returns:
- list of fired projectiles
-
rain
public static ArrayList<ParticleProjectile> rain(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location center, Settings settings, double radius, double height, int amount, ProjectileCallback callback, int lifespan) Fires a spread of projectiles from the location.- Parameters:
shooter- entity shooting the projectileslevel- level to use for scaling the speedcenter- the center location to rain onsettings- settings to use when firingradius- radius of the circleheight- height above the center locationamount- number of projectiles to firecallback- optional callback for when projectiles hit- Returns:
- list of fired projectiles
-