Class EffectUtils
This class groups helper methods used by RareSpawns to interact with Bukkit/Spigot entities and locations: potion effects, particles, sounds, damage/teleport helpers, and a variety of convenience predicates (e.g. biome/time/entity category checks).
Error handling
All methods are defensive: exceptions are caught, logged through
ValorlessUtils.Log, and the method returns a
sensible fallback value (typically false, 0, or -1) rather
than propagating the exception.
Threading
Many Bukkit API calls must be performed on the server/main thread. Callers are responsible for ensuring correct thread usage.
- Since:
- 1.0.0.beta.939
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleangleBetween(org.bukkit.entity.Entity e1, org.bukkit.entity.Entity e2) Computes the angle (in radians) between the facing directions of two entities.static doubleangleBetween(org.bukkit.Location l1, org.bukkit.Location l2) Computes the angle (in radians) between the facing directions of two locations.static booleanapplyPotionEffect(String effect, int level, int duration, org.bukkit.entity.LivingEntity target, boolean override) Applies a potion effect by name.static booleanapplyPotionEffect(org.bukkit.potion.PotionEffectType effect, int level, int duration, org.bukkit.entity.LivingEntity target, boolean override) Applies a potion effect by type.static booleanbleed(org.bukkit.entity.LivingEntity target, double amount) Spawns a red dust particle effect at the middle of the entity (visual "bleed").static booleanburn(int ticks, org.bukkit.entity.Entity target) Sets the entity on fire.static booleanconsoleCommand(String command) Dispatches a command from the server console.static booleandamage(org.bukkit.entity.LivingEntity target, double damage) Damages a living entity using Bukkit'sDamageable.damage(double).static booleandamageCone(org.bukkit.entity.Entity source, double radius, double angle, double damage) Damages living entities within a cone around the source's look direction.static doubledamageDistance(org.bukkit.entity.Entity source, org.bukkit.Location location, double baseDamage, double multiplier) Calculates damage based on distance from a source entity to a target location.static booleandamageRadius(org.bukkit.Location center, double radius, double damage) Damages all living entities within a radius.static doubledecreaseBy(double value, double percentage) Decreases a value by a percentage.static booleandisableKnockback(org.bukkit.entity.LivingEntity entity, int ticks) Temporarily sets knockback resistance to 1.0 for the given duration.static doubledistance(org.bukkit.entity.Entity e1, org.bukkit.entity.Entity e2) Measures distance between two entities.static doubledistance(org.bukkit.Location l1, org.bukkit.Location l2) Measures distance between two locations.static booleandropExperience(org.bukkit.Location location, int amount) Spawns anExperienceOrbat the given location.static booleanexplode(org.bukkit.Location location, float power, boolean setFire, boolean breakBlocks) Creates an explosion at the location.static booleanextinguish(org.bukkit.entity.Entity entity) Extinguishes an entity by setting its fire ticks to 0.static booleanfreeze(org.bukkit.entity.LivingEntity entity, int ticks) Temporarily sets movement speed to 0 for the given duration.static booleanhasLineOfSight(org.bukkit.entity.LivingEntity source, org.bukkit.entity.Entity target) Checks if the source has a direct line of sight to the target.static booleanhasLineOfSight(org.bukkit.Location source, org.bukkit.Location target) Checks if a straight ray between two locations is unobstructed by blocks.static doublehealthPercentage(org.bukkit.entity.Entity entity) Returns current health divided by max health.static doubleincreaseBy(double value, double percentage) Increases a value by a percentage.static booleanisAboveGround(org.bukkit.Location location) Checks whether the given location is at or above the world's sea level.static booleanisAquatic(org.bukkit.entity.Entity entity) Determines whether the given entity is considered an aquatic mob.static booleanisArthropod(org.bukkit.entity.Entity entity) Determines whether the given entity is considered an arthropod.static booleanisBoss(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a boss.static booleanisDaytime(org.bukkit.Location location) Checks whether it's currently daytime at the given location.static booleanisFlying(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a flying mob.static booleanisHostile(org.bukkit.entity.Entity entity) Determines whether the given entity is considered hostile.static booleanisInAir(org.bukkit.entity.Entity entity) Checks whether the given entity is airborne (not on ground and not in liquids).static booleanisInLava(org.bukkit.entity.Entity entity) Checks whether the entity's current block is lava.static booleanisInWater(org.bukkit.entity.Entity entity) Checks whether the entity is currently inside a liquid block.static booleanisLivingEntity(org.bukkit.entity.Entity entity) Checks whether the given entity is aLivingEntity.static booleanisMount(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a mount (rideable) entity.static booleanisNeutral(org.bukkit.entity.Entity entity) Determines whether the given entity is considered neutral.static booleanisNighttime(org.bukkit.Location location) Checks whether it's currently nighttime at the given location.static booleanisOnGround(org.bukkit.entity.Entity entity) Checks whether Bukkit reports the given entity is on the ground.static booleanisPassive(org.bukkit.entity.Entity entity) Determines whether the given entity is considered passive.static booleanisPlayer(org.bukkit.entity.Entity entity) Checks whether the given entity is a player.static booleanisRaining(org.bukkit.Location location) Checks whether the world at the given location currently has a storm.static booleanisTameable(org.bukkit.entity.Entity entity) Checks whether the given entity can be tamed (implementsTameable).static booleanisTamed(org.bukkit.entity.Entity entity) Checks whether the given entity is a tamedTameable.static booleanisThundering(org.bukkit.Location location) Checks whether the world at the given location is currently thundering.static booleanisUndead(org.bukkit.entity.Entity entity) Determines whether the given entity is considered undead.static booleanisUnderground(org.bukkit.Location location) Checks whether the given location is below sea level.static booleankill(org.bukkit.entity.Entity target) Kills an entity.static booleankill(org.bukkit.entity.Entity target, boolean noAnimation) Kills/removes an entity, optionally skipping the death animation.static booleanparticle(String particle, org.bukkit.Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles by name.static booleanparticle(org.bukkit.Particle particle, org.bukkit.Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles by type.static booleanparticleCircle(String particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a circle around a center point by particle name.static booleanparticleCircle(org.bukkit.Particle particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a circle around a center point by particle type.static booleanparticleLine(String particle, org.bukkit.Location start, org.bukkit.Location end, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a line between two points (name overload).static booleanparticleLine(org.bukkit.Particle particle, org.bukkit.Location start, org.bukkit.Location end, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a line between two points.static booleanparticleSphere(String particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles randomly distributed on a sphere surface (name overload).static booleanparticleSphere(org.bukkit.Particle particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles randomly distributed on a sphere surface.static booleanplayerCommand(String command, org.bukkit.entity.Player player) Has the player perform a command.static booleanPlays a sound to a player.static booleanPlays a sound at a location.static booleanprojectile(org.bukkit.entity.Entity shooter, String projectile, double speed, boolean direct) Spawns a projectile entity by type name.static booleanprojectile(org.bukkit.entity.Entity shooter, org.bukkit.entity.EntityType projectile, double speed, boolean direct) Spawns a projectile entity byEntityType.static booleanpullCloser(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double strength, boolean relative) Pulls the target towards the source by setting/adding velocity.static booleanpushAway(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double strength, boolean relative) Pushes the target away from the source by setting/adding velocity.static booleanremovePotionEffect(String effect, org.bukkit.entity.LivingEntity target) Removes a potion effect by name.static booleanremovePotionEffect(org.bukkit.potion.PotionEffectType effect, org.bukkit.entity.LivingEntity target) Removes a potion effect by type.static booleansendActionBar(org.bukkit.entity.Player player, String message) Sends an action bar message to the player.static booleansendMessage(org.bukkit.entity.Player player, String message) Sends a chat message to the player.static booleansendTitle(org.bukkit.entity.Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) Sends a title/subtitle to the player.static booleanshuffleHotbar(org.bukkit.entity.Player player) Randomly shuffles the player's hotbar (first 9 inventory slots).static booleanstrikeLightning(org.bukkit.Location location, boolean effectOnly) Strikes lightning at the location.static booleanteleport(org.bukkit.entity.Entity entity, org.bukkit.Location location) Teleports an entity.static booleanteleportAbove(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target entity above their current location.static booleanteleportBehind(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target behind the source's facing direction.static booleanteleportInFront(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target in front of the source's facing direction.static booleanteleportRelative(org.bukkit.entity.Entity entity, double x, double y, double z) Teleports an entity by an offset.static booleanteleportRelative(org.bukkit.entity.Entity entity, valorless.valorlessutils.types.Vector3<Double> offset) Teleports an entity by an offset.static booleantogglePermission(org.bukkit.entity.Player player, String permission) Toggles a permission for a player using a temporary attachment.
-
Constructor Details
-
EffectUtils
public EffectUtils()
-
-
Method Details
-
angleBetween
public static double angleBetween(org.bukkit.entity.Entity e1, org.bukkit.entity.Entity e2) Computes the angle (in radians) between the facing directions of two entities.- Parameters:
e1- first entitye2- second entity- Returns:
- angle in radians, or
-1on error
-
angleBetween
public static double angleBetween(org.bukkit.Location l1, org.bukkit.Location l2) Computes the angle (in radians) between the facing directions of two locations.Note: a
Locationonly has a direction if it has yaw/pitch set.- Parameters:
l1- first locationl2- second location- Returns:
- angle in radians, or
-1on error
-
applyPotionEffect
public static boolean applyPotionEffect(String effect, int level, int duration, org.bukkit.entity.LivingEntity target, boolean override) Applies a potion effect by name.The
levelis 1-based (Minecraft amplifier is 0-based), so this method useslevel - 1as the amplifier.- Parameters:
effect- effect name (case-insensitive). Example: "SPEED"level- 1-based levelduration- duration in tickstarget- target entityoverride- iftrue, an existing effect of the same type is removed first- Returns:
trueif applied;falseif invalid effect or on error
-
applyPotionEffect
public static boolean applyPotionEffect(org.bukkit.potion.PotionEffectType effect, int level, int duration, org.bukkit.entity.LivingEntity target, boolean override) Applies a potion effect by type.The
levelis 1-based (Minecraft amplifier is 0-based), so this method useslevel - 1as the amplifier.- Parameters:
effect- effect typelevel- 1-based levelduration- duration in tickstarget- target entityoverride- iftrue, an existing effect of the same type is removed first- Returns:
trueif applied;falseon error
-
bleed
public static boolean bleed(org.bukkit.entity.LivingEntity target, double amount) Spawns a red dust particle effect at the middle of the entity (visual "bleed").- Parameters:
target- target entityamount- currently unused (reserved for future scaling)- Returns:
trueif spawned;falseon error
-
burn
public static boolean burn(int ticks, org.bukkit.entity.Entity target) Sets the entity on fire.- Parameters:
ticks- fire duration in tickstarget- target entity- Returns:
trueif applied;falseon error
-
consoleCommand
Dispatches a command from the server console.- Parameters:
command- raw command string- Returns:
trueif dispatched;falseon error
-
damage
public static boolean damage(org.bukkit.entity.LivingEntity target, double damage) Damages a living entity using Bukkit'sDamageable.damage(double).- Parameters:
target- target entitydamage- amount of damage- Returns:
trueif applied;falseon error
-
damageCone
public static boolean damageCone(org.bukkit.entity.Entity source, double radius, double angle, double damage) Damages living entities within a cone around the source's look direction.- Parameters:
source- source entity (cone origin + direction)radius- search radiusangle- cone angle in degreesdamage- damage to apply- Returns:
trueif processed;falseon error
-
damageDistance
public static double damageDistance(org.bukkit.entity.Entity source, org.bukkit.Location location, double baseDamage, double multiplier) Calculates damage based on distance from a source entity to a target location.- Parameters:
source- source entitylocation- target locationbaseDamage- base damage at zero distancemultiplier- damage increase per block of distance- Returns:
- calculated damage, or
baseDamageon error
-
damageRadius
public static boolean damageRadius(org.bukkit.Location center, double radius, double damage) Damages all living entities within a radius.- Parameters:
center- center pointradius- radius in blocksdamage- damage per entity- Returns:
trueif processed;falseon error
-
decreaseBy
public static double decreaseBy(double value, double percentage) Decreases a value by a percentage.- Parameters:
value- base valuepercentage- percentage to subtract (e.g. 25 => value * 0.75)- Returns:
- decreased value (or original value on error)
-
disableKnockback
public static boolean disableKnockback(org.bukkit.entity.LivingEntity entity, int ticks) Temporarily sets knockback resistance to 1.0 for the given duration.- Parameters:
entity- target entityticks- duration in ticks- Returns:
trueif scheduled;falseon error
-
distance
public static double distance(org.bukkit.entity.Entity e1, org.bukkit.entity.Entity e2) Measures distance between two entities.- Parameters:
e1- first entitye2- second entity- Returns:
- distance, or
-1on error
-
distance
public static double distance(org.bukkit.Location l1, org.bukkit.Location l2) Measures distance between two locations.- Parameters:
l1- first locationl2- second location- Returns:
- distance, or
-1on error
-
dropExperience
public static boolean dropExperience(org.bukkit.Location location, int amount) Spawns anExperienceOrbat the given location.- Parameters:
location- spawn locationamount- experience amount- Returns:
trueif spawned;falseon error
-
explode
public static boolean explode(org.bukkit.Location location, float power, boolean setFire, boolean breakBlocks) Creates an explosion at the location.- Parameters:
location- explosion locationpower- explosion powersetFire- whether to set firebreakBlocks- whether blocks can be broken- Returns:
trueif created;falseon error
-
extinguish
public static boolean extinguish(org.bukkit.entity.Entity entity) Extinguishes an entity by setting its fire ticks to 0.- Parameters:
entity- target entity- Returns:
trueif applied;falseon error
-
freeze
public static boolean freeze(org.bukkit.entity.LivingEntity entity, int ticks) Temporarily sets movement speed to 0 for the given duration.- Parameters:
entity- target entityticks- duration in ticks- Returns:
trueif scheduled;falseon error
-
hasLineOfSight
public static boolean hasLineOfSight(org.bukkit.entity.LivingEntity source, org.bukkit.entity.Entity target) Checks if the source has a direct line of sight to the target.- Parameters:
source- source living entitytarget- target entity- Returns:
trueif visible, otherwisefalse
-
hasLineOfSight
public static boolean hasLineOfSight(org.bukkit.Location source, org.bukkit.Location target) Checks if a straight ray between two locations is unobstructed by blocks.- Parameters:
source- source locationtarget- target location- Returns:
trueif unobstructed, otherwisefalse
-
healthPercentage
public static double healthPercentage(org.bukkit.entity.Entity entity) Returns current health divided by max health.- Parameters:
entity- entity to check- Returns:
- health percentage in range [0..1], or 0 on error / non-living
-
increaseBy
public static double increaseBy(double value, double percentage) Increases a value by a percentage.- Parameters:
value- base valuepercentage- percentage to add (e.g. 25 => value * 1.25)- Returns:
- increased value (or original value on error)
-
isAboveGround
public static boolean isAboveGround(org.bukkit.Location location) Checks whether the given location is at or above the world's sea level.- Parameters:
location- location to check- Returns:
trueif Y is at or above sea level
-
isAquatic
public static boolean isAquatic(org.bukkit.entity.Entity entity) Determines whether the given entity is considered an aquatic mob.- Parameters:
entity- entity to check- Returns:
trueif the entity is considered aquatic
-
isArthropod
public static boolean isArthropod(org.bukkit.entity.Entity entity) Determines whether the given entity is considered an arthropod.- Parameters:
entity- entity to check- Returns:
trueif the entity is considered an arthropod
-
isBoss
public static boolean isBoss(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a boss.- Parameters:
entity- entity to check- Returns:
trueif the entity is considered a boss
-
isDaytime
public static boolean isDaytime(org.bukkit.Location location) Checks whether it's currently daytime at the given location.- Parameters:
location- location to check- Returns:
trueif world time is day (0..12299)
-
isFlying
public static boolean isFlying(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a flying mob.- Parameters:
entity- entity to check- Returns:
trueif the entity is considered flying
-
isHostile
public static boolean isHostile(org.bukkit.entity.Entity entity) Determines whether the given entity is considered hostile.- Parameters:
entity- entity to check- Returns:
trueif the entity is considered hostile
-
isInAir
public static boolean isInAir(org.bukkit.entity.Entity entity) Checks whether the given entity is airborne (not on ground and not in liquids).- Parameters:
entity- entity to check- Returns:
trueif not on ground and not in water/lava
-
isInLava
public static boolean isInLava(org.bukkit.entity.Entity entity) Checks whether the entity's current block is lava.- Parameters:
entity- entity to check- Returns:
trueif the entity's current block type contains "LAVA"
-
isInWater
public static boolean isInWater(org.bukkit.entity.Entity entity) Checks whether the entity is currently inside a liquid block.- Parameters:
entity- entity to check- Returns:
trueif the entity's current block is liquid
-
isLivingEntity
public static boolean isLivingEntity(org.bukkit.entity.Entity entity) Checks whether the given entity is aLivingEntity.- Parameters:
entity- entity- Returns:
trueif entity is aLivingEntity
-
isMount
public static boolean isMount(org.bukkit.entity.Entity entity) Determines whether the given entity is considered a mount (rideable) entity.- Parameters:
entity- entity- Returns:
trueif entity is considered a mount
-
isNeutral
public static boolean isNeutral(org.bukkit.entity.Entity entity) Determines whether the given entity is considered neutral.- Parameters:
entity- entity- Returns:
trueif entity is considered neutral
-
isNighttime
public static boolean isNighttime(org.bukkit.Location location) Checks whether it's currently nighttime at the given location.- Parameters:
location- location- Returns:
trueif world time is night (12300..23849)
-
isOnGround
public static boolean isOnGround(org.bukkit.entity.Entity entity) Checks whether Bukkit reports the given entity is on the ground.- Parameters:
entity- entity- Returns:
trueif Bukkit reports the entity is on the ground
-
isPassive
public static boolean isPassive(org.bukkit.entity.Entity entity) Determines whether the given entity is considered passive.- Parameters:
entity- entity- Returns:
trueif entity is considered passive
-
isPlayer
public static boolean isPlayer(org.bukkit.entity.Entity entity) Checks whether the given entity is a player.- Parameters:
entity- entity- Returns:
trueif entity is aPlayer
-
isRaining
public static boolean isRaining(org.bukkit.Location location) Checks whether the world at the given location currently has a storm.- Parameters:
location- location- Returns:
trueif the world currently has a storm
-
isTameable
public static boolean isTameable(org.bukkit.entity.Entity entity) Checks whether the given entity can be tamed (implementsTameable).- Parameters:
entity- entity- Returns:
trueif entity implementsTameable
-
isTamed
public static boolean isTamed(org.bukkit.entity.Entity entity) Checks whether the given entity is a tamedTameable.- Parameters:
entity- entity- Returns:
trueif entity is a tamedTameable
-
isThundering
public static boolean isThundering(org.bukkit.Location location) Checks whether the world at the given location is currently thundering.- Parameters:
location- location- Returns:
trueif the world is thundering
-
isUndead
public static boolean isUndead(org.bukkit.entity.Entity entity) Determines whether the given entity is considered undead.- Parameters:
entity- entity- Returns:
trueif entity is considered undead
-
isUnderground
public static boolean isUnderground(org.bukkit.Location location) Checks whether the given location is below sea level.- Parameters:
location- location- Returns:
trueif below sea level
-
kill
public static boolean kill(org.bukkit.entity.Entity target) Kills an entity.For living entities this sets health to 0, otherwise it removes the entity.
- Parameters:
target- target entity- Returns:
trueif killed/removed;falseon error
-
kill
public static boolean kill(org.bukkit.entity.Entity target, boolean noAnimation) Kills/removes an entity, optionally skipping the death animation.- Parameters:
target- target entitynoAnimation- iftruethe entity is removed directly- Returns:
trueif killed/removed;falseon error
-
particle
public static boolean particle(String particle, org.bukkit.Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles by name.- Parameters:
particle- particle name (case-insensitive)location- spawn locationcount- number of particlesoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon invalid particle or error
-
particle
public static boolean particle(org.bukkit.Particle particle, org.bukkit.Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles by type.- Parameters:
particle- particle typelocation- spawn locationcount- number of particlesoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleCircle
public static boolean particleCircle(String particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a circle around a center point by particle name.- Parameters:
particle- particle namecenter- center locationradius- circle radiuspoints- number of points/stepsoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleCircle
public static boolean particleCircle(org.bukkit.Particle particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a circle around a center point by particle type.- Parameters:
particle- particle typecenter- center locationradius- circle radiuspoints- number of points/stepsoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleLine
public static boolean particleLine(String particle, org.bukkit.Location start, org.bukkit.Location end, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a line between two points (name overload).- Parameters:
particle- particle namestart- start locationend- end locationpoints- number of points to sampleoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleLine
public static boolean particleLine(org.bukkit.Particle particle, org.bukkit.Location start, org.bukkit.Location end, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles along a line between two points.- Parameters:
particle- particle typestart- start locationend- end locationpoints- number of points to sampleoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleSphere
public static boolean particleSphere(String particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles randomly distributed on a sphere surface (name overload).- Parameters:
particle- particle namecenter- center locationradius- sphere radiuspoints- number of particles/pointsoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
particleSphere
public static boolean particleSphere(org.bukkit.Particle particle, org.bukkit.Location center, double radius, int points, double offsetX, double offsetY, double offsetZ, double extra) Spawns particles randomly distributed on a sphere surface.- Parameters:
particle- particle typecenter- center locationradius- sphere radiuspoints- number of particles/pointsoffsetX- offset XoffsetY- offset YoffsetZ- offset Zextra- extra data (speed)- Returns:
trueif spawned;falseon error
-
playSound
public static boolean playSound(org.bukkit.Location location, String sound, float volume, float pitch) Plays a sound at a location.- Parameters:
location- target locationsound- sound id/string understood bySound.parse(String)volume- volumepitch- pitch- Returns:
trueif played;falseon error
-
playSound
public static boolean playSound(org.bukkit.entity.Player player, String sound, float volume, float pitch) Plays a sound to a player.- Parameters:
player- target playersound- sound id/string understood bySound.parse(String)volume- volumepitch- pitch- Returns:
trueif played;falseon error
-
playerCommand
Has the player perform a command.- Parameters:
command- command to executeplayer- command sender- Returns:
trueif performed;falseon error
-
projectile
public static boolean projectile(org.bukkit.entity.Entity shooter, String projectile, double speed, boolean direct) Spawns a projectile entity by type name.- Parameters:
shooter- shooter entityprojectile- entity type name, e.g. "ARROW"speed- velocity multiplierdirect- iftruesets velocity directly, otherwise adds to existing velocity- Returns:
trueif spawned;falseon error
-
projectile
public static boolean projectile(org.bukkit.entity.Entity shooter, org.bukkit.entity.EntityType projectile, double speed, boolean direct) Spawns a projectile entity byEntityType.- Parameters:
shooter- shooter entityprojectile- projectile entity typespeed- velocity multiplierdirect- iftruesets velocity directly, otherwise adds to existing velocity- Returns:
trueif spawned;falseon error
-
pullCloser
public static boolean pullCloser(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double strength, boolean relative) Pulls the target towards the source by setting/adding velocity.- Parameters:
source- source entitytarget- target entitystrength- velocity multiplierrelative- iftrueadds to current velocity, otherwise overrides it- Returns:
trueif applied;falseon error
-
pushAway
public static boolean pushAway(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double strength, boolean relative) Pushes the target away from the source by setting/adding velocity.- Parameters:
source- source entitytarget- target entitystrength- velocity multiplierrelative- iftrueadds to current velocity, otherwise overrides it- Returns:
trueif applied;falseon error
-
removePotionEffect
public static boolean removePotionEffect(org.bukkit.potion.PotionEffectType effect, org.bukkit.entity.LivingEntity target) Removes a potion effect by type.- Parameters:
effect- effect typetarget- target entity- Returns:
trueif removed;falseon error
-
removePotionEffect
Removes a potion effect by name.- Parameters:
effect- effect name (case-insensitive)target- target entity- Returns:
trueif removed;falseif invalid effect or on error
-
sendActionBar
Sends an action bar message to the player.- Parameters:
player- target playermessage- message (supports language parsing)- Returns:
trueif sent;falseon error
-
sendMessage
Sends a chat message to the player.- Parameters:
player- target playermessage- message (supports language parsing)- Returns:
trueif sent;falseon error
-
sendTitle
public static boolean sendTitle(org.bukkit.entity.Player player, @Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut) Sends a title/subtitle to the player.- Parameters:
player- target playertitle- title text (nullable)subtitle- subtitle text (nullable)fadeIn- fade in ticksstay- stay ticksfadeOut- fade out ticks- Returns:
trueif sent;falseon error
-
shuffleHotbar
public static boolean shuffleHotbar(org.bukkit.entity.Player player) Randomly shuffles the player's hotbar (first 9 inventory slots).- Parameters:
player- target player- Returns:
trueif shuffled;falseon error
-
strikeLightning
public static boolean strikeLightning(org.bukkit.Location location, boolean effectOnly) Strikes lightning at the location.- Parameters:
location- target locationeffectOnly- iftrue, only plays the effect (no damage)- Returns:
trueif executed;falseon error
-
teleport
public static boolean teleport(org.bukkit.entity.Entity entity, org.bukkit.Location location) Teleports an entity.- Parameters:
entity- entity to teleportlocation- destination- Returns:
trueif teleported;falseon error
-
teleportAbove
public static boolean teleportAbove(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target entity above their current location.- Parameters:
source- unused (kept for API symmetry)target- target entitydistance- amount to add to Y- Returns:
trueif teleported;falseon error
-
teleportBehind
public static boolean teleportBehind(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target behind the source's facing direction.- Parameters:
source- source entity (direction is used)target- target entitydistance- distance behind- Returns:
trueif teleported;falseon error
-
teleportInFront
public static boolean teleportInFront(org.bukkit.entity.Entity source, org.bukkit.entity.Entity target, double distance) Teleports the target in front of the source's facing direction.- Parameters:
source- source entity (direction is used)target- target entitydistance- distance in front- Returns:
trueif teleported;falseon error
-
teleportRelative
public static boolean teleportRelative(org.bukkit.entity.Entity entity, double x, double y, double z) Teleports an entity by an offset.- Parameters:
entity- entityx- x offsety- y offsetz- z offset- Returns:
trueif teleported;falseon error
-
teleportRelative
public static boolean teleportRelative(org.bukkit.entity.Entity entity, valorless.valorlessutils.types.Vector3<Double> offset) Teleports an entity by an offset.- Parameters:
entity- entityoffset- offset vector- Returns:
trueif teleported;falseon error
-
togglePermission
Toggles a permission for a player using a temporary attachment.- Parameters:
player- target playerpermission- permission node- Returns:
trueif toggled;falseon error
-