Package org.bukkit.entity
Interface AbstractArrow
- All Superinterfaces:
Audience
,CommandSender
,Entity
,HoverEventSource<HoverEvent.ShowEntity>
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,PersistentDataViewHolder
,Pointered
,Projectile
,ServerOperator
,Sound.Emitter
- All Known Subinterfaces:
Arrow
,SpectralArrow
,TippedArrow
,Trident
Represents an arrow.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Deprecated.static enum
Represents the pickup status of this arrow.Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot
-
Method Summary
Modifier and TypeMethodDescriptionGets the block to which this arrow is attached.double
Gets the base amount of damage this arrow will do.Gets the sound that is played when this arrow hits an entity.getItem()
Deprecated, for removal: This API element is subject to removal in a future version.Gets theItemStack
for this arrow.int
Deprecated.a function of the firing weaponint
Gets how many ticks this arrow has been in the world for.default AbstractArrow.PickupRule
Deprecated.UsegetPickupStatus()
as an upstream compatible replacement for this functionGets the current pickup status of this arrow.int
Gets the number of times this arrow can pierce through an entity.Gets the ItemStack which fired this arrow.boolean
Gets whether this arrow is critical.boolean
Gets whether this arrow is in a block or not.boolean
Gets if this arrow was shot from a crossbow.void
setCritical
(boolean critical) Sets whether or not this arrow should be critical.void
setDamage
(double damage) Sets the base amount of damage this arrow will do.void
setHitSound
(Sound sound) Sets the sound that is played when this arrow hits an entity.void
Deprecated, for removal: This API element is subject to removal in a future version.usegetItemStack()
void
setItemStack
(@NotNull ItemStack stack) Sets theItemStack
for this arrow.void
setKnockbackStrength
(int knockbackStrength) Deprecated.a function of the firing weaponvoid
setLifetimeTicks
(int ticks) Sets the amount of ticks this arrow has been alive in the world This is used to determine when the arrow should be automatically despawned.default void
Deprecated.UsesetPickupStatus(PickupStatus)
withAbstractArrow.PickupStatus
as an upstream compatible replacement for this functionvoid
Sets the current pickup status of this arrow.void
setPierceLevel
(int pierceLevel) Sets the number of times this arrow can pierce through an entity.void
setShooter
(ProjectileSource source, boolean resetPickupStatus) Set the shooter of this projectile.void
setShotFromCrossbow
(boolean shotFromCrossbow) Deprecated.a function of the firing weapon insteadvoid
Sets the ItemStack which fired this arrow.Methods inherited from interface net.kyori.adventure.audience.Audience
clearResourcePacks, clearTitle, deleteMessage, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, sendResourcePacks, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface org.bukkit.command.CommandSender
getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlainMessage, sendRichMessage, sendRichMessage
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, asHoverEvent, broadcastHurtAnimation, collidesAt, copy, copy, createSnapshot, eject, fromMobSpawner, getAsString, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPitch, getPortalCooldown, getPose, getRider, getScheduler, getScoreboardEntryName, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, getX, getY, getYaw, getZ, hasFixedPose, hasGravity, hasNoPhysics, hasRider, isCustomNameVisible, isDead, isEmpty, isFreezeTickingLocked, isFrozen, isGlowing, isImmuneToFire, isInBubbleColumn, isInDaylight, isInLava, isInPowderedSnow, isInRain, isInsideVehicle, isInvisible, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isInWorld, isOnGround, isPersistent, isRidable, isRidableInWater, isSilent, isSneaking, isTicking, isUnderWater, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, lockFreezeTicks, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setImmuneToFire, setInvisible, setInvulnerable, setLastDamageCause, setNoPhysics, setPassenger, setPersistent, setPortalCooldown, setPose, setPose, setRotation, setSilent, setSneaking, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync, teleportAsync, wouldCollideUsing
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.Nameable
customName, customName, getCustomName, setCustomName
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
Methods inherited from interface org.bukkit.entity.Projectile
canHitEntity, doesBounce, getOwnerUniqueId, getShooter, hasBeenShot, hasLeftShooter, hitEntity, hitEntity, setBounce, setHasBeenShot, setHasLeftShooter, setShooter
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
getKnockbackStrength
Deprecated.a function of the firing weaponGets the knockback strength for an arrow, which is theKnockBack
level of the bow that shot it.- Returns:
- the knockback strength value
- See Also:
-
setKnockbackStrength
Deprecated.a function of the firing weaponSets the knockback strength for an arrow.- Parameters:
knockbackStrength
- the knockback strength value- See Also:
-
getDamage
double getDamage()Gets the base amount of damage this arrow will do. Defaults to 2.0 for a normal arrow with0.5 * (1 + power level)
added for arrows fired from enchanted bows.- Returns:
- base damage amount
-
setDamage
void setDamage(double damage) Sets the base amount of damage this arrow will do.- Parameters:
damage
- new damage amount
-
getPierceLevel
int getPierceLevel()Gets the number of times this arrow can pierce through an entity.- Returns:
- pierce level
-
setPierceLevel
void setPierceLevel(int pierceLevel) Sets the number of times this arrow can pierce through an entity. Must be between 0 and 127 times.- Parameters:
pierceLevel
- new pierce level
-
isCritical
boolean isCritical()Gets whether this arrow is critical.Critical arrows have increased damage and cause particle effects.
Critical arrows generally occur when a player fully draws a bow before firing.
- Returns:
- true if it is critical
-
setCritical
void setCritical(boolean critical) Sets whether or not this arrow should be critical.- Parameters:
critical
- whether or not it should be critical
-
isInBlock
boolean isInBlock()Gets whether this arrow is in a block or not.Arrows in a block are motionless and may be picked up by players.
- Returns:
- true if in a block
-
getAttachedBlock
Gets the block to which this arrow is attached.- Returns:
- the attached block or null if not attached
-
getPickupStatus
Gets the current pickup status of this arrow.- Returns:
- the pickup status of this arrow.
-
setPickupStatus
Sets the current pickup status of this arrow.- Parameters:
status
- new pickup status of this arrow.
-
isShotFromCrossbow
boolean isShotFromCrossbow()Gets if this arrow was shot from a crossbow.- Returns:
- if shot from a crossbow
-
setShotFromCrossbow
Deprecated.a function of the firing weapon insteadSets if this arrow was shot from a crossbow.- Parameters:
shotFromCrossbow
- if shot from a crossbow- See Also:
-
getItem
Deprecated, for removal: This API element is subject to removal in a future version.usegetItemStack()
Gets the ItemStack which will be picked up from this arrow.- Returns:
- The picked up ItemStack
-
setItem
@Experimental @Deprecated(forRemoval=true, since="1.20.4") void setItem(@NotNull @NotNull ItemStack item) Deprecated, for removal: This API element is subject to removal in a future version.usegetItemStack()
Sets the ItemStack which will be picked up from this arrow.- Parameters:
item
- ItemStack set to be picked up
-
getWeapon
Gets the ItemStack which fired this arrow.- Returns:
- The firing ItemStack
-
setWeapon
Sets the ItemStack which fired this arrow.- Parameters:
item
- The firing ItemStack
-
getPickupRule
Deprecated.UsegetPickupStatus()
as an upstream compatible replacement for this functionGets theAbstractArrow.PickupRule
for this arrow.This is generally
AbstractArrow.PickupRule.ALLOWED
only if the arrow was not fired from a bow with the infinity enchantment.- Returns:
- The pickup rule
-
setPickupRule
Deprecated.UsesetPickupStatus(PickupStatus)
withAbstractArrow.PickupStatus
as an upstream compatible replacement for this functionSet the rule for which players can pickup this arrow as an item.- Parameters:
rule
- The pickup rule
-
getItemStack
Gets theItemStack
for this arrow. This stack is used for both visuals on the arrow and the stack that could be picked up.- Returns:
- The ItemStack, as if a player picked up the arrow
-
setItemStack
Sets theItemStack
for this arrow. This stack is used for both visuals on the arrow and the stack that could be picked up.- Parameters:
stack
- the arrow stack
-
setLifetimeTicks
void setLifetimeTicks(int ticks) Sets the amount of ticks this arrow has been alive in the world This is used to determine when the arrow should be automatically despawned.- Parameters:
ticks
- lifetime ticks
-
getLifetimeTicks
int getLifetimeTicks()Gets how many ticks this arrow has been in the world for.- Returns:
- ticks this arrow has been in the world
-
getHitSound
Gets the sound that is played when this arrow hits an entity.- Returns:
- sound that plays
-
setHitSound
Sets the sound that is played when this arrow hits an entity.- Parameters:
sound
- sound that is played
-
setShooter
Set the shooter of this projectile.- Parameters:
source
- theProjectileSource
that shot this projectileresetPickupStatus
- whether theAbstractArrow.PickupStatus
should be reset
-
getItemStack()