Package org.bukkit.entity
Interface Firework
- All Superinterfaces:
CommandSender
,Entity
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,Projectile
,ServerOperator
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot
-
Method Summary
Modifier and TypeMethodDescriptionvoid
detonate()
Cause this firework to explode at earliest opportunity, as if it has no remaining fuse.Get theLivingEntity
to which this firework is attached.Get a copy of the fireworks metaint
getLife()
Get the ticks that this firework has been alive.int
Get the time in ticks this firework will exist until it is detonated.boolean
Check whether or not this firework has detonated.boolean
Gets if the firework was shot at an angle (i.e.boolean
setAttachedTo
(LivingEntity entity) Set theLivingEntity
to which this firework is attached.void
setFireworkMeta
(FireworkMeta meta) Apply the provided meta to the fireworksboolean
setLife
(int ticks) Set the ticks that this firework has been alive.boolean
setMaxLife
(int ticks) Set the time in ticks this firework will exist until it is detonated.void
setShotAtAngle
(boolean shotAtAngle) Sets if the firework was shot at an angle (i.e.Methods inherited from interface org.bukkit.command.CommandSender
getName, sendMessage, sendMessage, sendMessage, sendMessage
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, copy, copy, createSnapshot, eject, getAsString, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isInWorld, isOnGround, isPersistent, isSilent, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spigot, teleport, teleport, teleport, teleport
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
getCustomName, setCustomName
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface org.bukkit.entity.Projectile
doesBounce, getShooter, setBounce, setShooter
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
getFireworkMeta
Get a copy of the fireworks meta- Returns:
- A copy of the current Firework meta
-
setFireworkMeta
Apply the provided meta to the fireworks- Parameters:
meta
- The FireworkMeta to apply
-
setAttachedTo
Set theLivingEntity
to which this firework is attached.When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity
LivingEntity#isGliding() is gliding
, then the entity will receive a boost in the direction that they are looking.- Parameters:
entity
- the entity to which the firework should be attached, or null to remove the attached entity- Returns:
- true if the entity could be attached, false if the firework was already detonated
-
getAttachedTo
Get theLivingEntity
to which this firework is attached.When attached to an entity, the firework effect will act as normal but remain positioned on the entity. If the entity
LivingEntity#isGliding() is gliding
, then the entity will receive a boost in the direction that they are looking.- Returns:
- the attached entity, or null if none
-
setLife
boolean setLife(int ticks) Set the ticks that this firework has been alive. If this value exceedsgetMaxLife()
, the firework will detonate.- Parameters:
ticks
- the ticks to set. Must be greater than or equal to 0- Returns:
- true if the life was set, false if this firework has already detonated
-
getLife
int getLife()Get the ticks that this firework has been alive. When this value reachesgetMaxLife()
, the firework will detonate.- Returns:
- the life ticks
-
setMaxLife
boolean setMaxLife(int ticks) Set the time in ticks this firework will exist until it is detonated.- Parameters:
ticks
- the ticks to set. Must be greater than 0- Returns:
- true if the time was set, false if this firework has already detonated
-
getMaxLife
int getMaxLife()Get the time in ticks this firework will exist until it is detonated.- Returns:
- the maximum life in ticks
-
detonate
void detonate()Cause this firework to explode at earliest opportunity, as if it has no remaining fuse. -
isDetonated
boolean isDetonated()Check whether or not this firework has detonated.- Returns:
- true if detonated, false if still in the world
-
isShotAtAngle
boolean isShotAtAngle()Gets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.- Returns:
- shot at angle status
-
setShotAtAngle
void setShotAtAngle(boolean shotAtAngle) Sets if the firework was shot at an angle (i.e. from a crossbow). A firework which was not shot at an angle will fly straight upwards.- Parameters:
shotAtAngle
- the new shotAtAngle
-