Package-level declarations

Types

Link copied to clipboard
class AttributeBuilder(attributable: Attributable)

A DSL builder for modifying entity attributes.

Link copied to clipboard
annotation class EntityDsl

DSL marker annotation for the entity DSL.

Link copied to clipboard

Builder for creating entity stacks (passenger chains) using a DSL approach.

Link copied to clipboard
class EquipmentBuilder(equipment: EntityEquipment)

A DSL builder for modifying the equipment of a living entity.

Link copied to clipboard

A DSL interface for reading and writing persistent data on an entity's PersistentDataContainer.

Properties

Link copied to clipboard
var Mob.isNoAi: Boolean

Gets or sets whether this mob has AI. This is a wrapper for Mob.hasAI.

Functions

Link copied to clipboard
fun LivingEntity.absorption(duration: Duration, amplifier: Int = 0)

Applies the Absorption effect to this entity.

Link copied to clipboard
fun LivingEntity.addEffect(type: PotionEffectType, duration: Duration, amplifier: Int = 0, ambient: Boolean = true, particles: Boolean = true, icon: Boolean = true)

Applies a potion effect to this living entity with the specified parameters.

Link copied to clipboard
fun <M : Mob> M.addGoals(priority: Int, goal: Goal<M>)

Adds a single goal to this mob with the specified priority.

fun <M : Mob> M.addGoals(priority: Int, vararg goals: Goal<M>)

Adds multiple goals to this mob with the same priority.

Link copied to clipboard
fun Entity.addTrail(plugin: Plugin, particle: Particle, count: Int = 1, offset: Double = 0.0, extra: Double = 0.0, onlyOnMove: Boolean = true): TaskHandle

Adds a particle trail to this entity.

Link copied to clipboard
fun Entity.attributes(editor: AttributeBuilder.() -> Unit)

Extension function to modify entity attributes using a DSL.

Link copied to clipboard
fun LivingEntity.badOmen(duration: Duration, amplifier: Int = 0)

Applies the Bad Omen effect to this entity.

Link copied to clipboard
fun LivingEntity.blindness(duration: Duration, amplifier: Int = 0)

Applies the Blindness effect to this entity.

Link copied to clipboard
fun <M : Mob> M.clearAI()

Clears the current target and pathfinding of this mob.

Link copied to clipboard
fun <M : Mob> M.clearGoals()

Removes all goals from this mob.

Link copied to clipboard
fun LivingEntity.conduitPower(duration: Duration, amplifier: Int = 0)

Applies the Conduit Power effect to this entity.

Link copied to clipboard
fun Entity.data(editor: PersistentDataEditor.() -> Unit)

Edits the persistent data of this entity using a DSL builder.

Link copied to clipboard
fun LivingEntity.dolphinsGrace(duration: Duration, amplifier: Int = 0)

Applies the Dolphin's Grace effect to this entity.

Link copied to clipboard
fun Entity.equipment(editor: EquipmentBuilder.() -> Unit)

Modifies the equipment of this entity using a DSL builder.

Link copied to clipboard
fun LivingEntity.fireResistance(duration: Duration, amplifier: Int = 0)

Applies the Fire Resistance effect to this entity.

Link copied to clipboard
fun Entity.follow(plugin: Plugin, target: Entity, speed: Double = 1.0, stopDistance: Double = 2.0): TaskHandle

Makes this entity follow another entity.

Link copied to clipboard
inline operator fun <T : Any> PersistentDataEditor.get(key: NamespacedKey): T?

Retrieves a value from the container using the inferred type T.

Link copied to clipboard
fun <M : Mob> M.getActiveGoals(): Collection<Goal<M>>

Retrieves all currently active (running) goals of this mob.

Link copied to clipboard
fun <M : Mob> M.getAllGoals(): Collection<Goal<M>>

Retrieves all goals registered to this mob, both active and inactive.

Link copied to clipboard
inline fun <T : Any> getDataType(clazz: KClass<T>): PersistentDataType<T, T>

Returns the PersistentDataType corresponding to the given Kotlin KClass.

Link copied to clipboard
fun <M : Mob> M.getGoal(key: GoalKey<M>): Collection<Goal<M>>

Retrieves all goals from this mob with the specified GoalKey.

inline fun <M : Mob> M.getGoal(key: NamespacedKey): Collection<Goal<M>>

Retrieves all goals from this mob with the specified NamespacedKey.

Link copied to clipboard
inline fun <T> Entity.getMetadataValue(key: String): T?

Retrieves metadata value from this entity for the specified key.

Link copied to clipboard
inline fun <E : Entity> Location.getNearbyEntitiesByType(radius: Double = 1.0): List<E>

Gets all nearby entities of type E within the specified radius.

inline fun <E : Entity> Location.getNearbyEntitiesByType(radius: Double = 1.0, predicate: (E) -> Boolean = { true }): List<E>

Gets all nearby entities of type E within the specified radius that match the predicate.

inline fun <E : Entity> Location.getNearbyEntitiesByType(x: Double = 1.0, y: Double = 1.0, z: Double = 1.0): List<E>

Gets all nearby entities of type E within the specified dimensions.

inline fun <E : Entity> Location.getNearbyEntitiesByType(x: Double = 1.0, y: Double = 1.0, z: Double = 1.0, predicate: (E) -> Boolean = { true }): List<E>

Gets all nearby entities of type E within the specified dimensions that match the predicate.

Link copied to clipboard
fun LivingEntity.glowing(duration: Duration, amplifier: Int = 0)

Applies the Glowing effect to this entity.

Link copied to clipboard
fun <M : Mob> M.hasGoal(key: GoalKey<M>): Boolean

Checks if this mob has a goal with the specified GoalKey.

inline fun <M : Mob> M.hasGoal(key: NamespacedKey): Boolean

Checks if this mob has a goal with the specified NamespacedKey.

Link copied to clipboard
fun LivingEntity.haste(duration: Duration, amplifier: Int = 0)

Applies the Haste effect to this entity.

Link copied to clipboard
fun LivingEntity.healthBoost(duration: Duration, amplifier: Int = 0)

Applies the Health Boost effect to this entity.

Link copied to clipboard
fun LivingEntity.heroOfTheVillage(duration: Duration, amplifier: Int = 0)

Applies the Hero of the Village effect to this entity.

Link copied to clipboard
fun LivingEntity.hunger(duration: Duration, amplifier: Int = 0)

Applies the Hunger effect to this entity.

Link copied to clipboard
fun LivingEntity.invisibility(duration: Duration, amplifier: Int = 0)

Applies the Invisibility effect to this entity.

Link copied to clipboard
fun LivingEntity.jump(duration: Duration, amplifier: Int = 0)

Applies the Jump Boost effect to this entity.

Link copied to clipboard
fun LivingEntity.levitation(duration: Duration, amplifier: Int = 0)

Applies the Levitation effect to this entity.

Link copied to clipboard
fun LivingEntity.luck(duration: Duration, amplifier: Int = 0)

Applies the Luck effect to this entity.

Link copied to clipboard
fun Entity.mountStack(block: EntityStackBuilder.() -> Unit)

Builds an entity stack (passengers) where each entity mounts on top of the previous one.

Link copied to clipboard
fun Mob.moveTo(location: Location, speed: Double = 1.0): Boolean

Makes this mob move to a specific location.

Link copied to clipboard
fun LivingEntity.nightVision(duration: Duration, amplifier: Int = 0)

Applies the Night Vision effect to this entity.

Link copied to clipboard
fun Entity.onDamage(plugin: Plugin, handle: EntityDamageEvent.() -> Unit)

Executes the handle when this entity takes damage.

Link copied to clipboard
fun Entity.onDeath(plugin: Plugin, handle: EntityDeathEvent.() -> Unit)

Executes the handle when this entity dies.

Link copied to clipboard
inline fun <T : Event> Entity.onEvent(plugin: Plugin, crossinline getEntity: T.() -> Entity?, noinline handle: T.() -> Unit)

Registers an event listener for this specific entity. The listener will be automatically unregistered if the entity is no longer valid.

Link copied to clipboard
fun <E : Entity> E.onTick(plugin: Plugin, period: Ticks = 1.ticks, delay: Ticks = 0.ticks, action: E.() -> Unit): TaskHandle

Executes the action every period ticks as long as the entity is valid.

Link copied to clipboard
fun LivingEntity.poison(duration: Duration, amplifier: Int = 0)

Applies the Poison effect to this entity.

Link copied to clipboard
fun LivingEntity.regeneration(duration: Duration, amplifier: Int = 0)

Applies the Regeneration effect to this entity.

Link copied to clipboard
fun Entity.removeAfter(plugin: Plugin, duration: Duration): TaskHandle

Automatically removes this entity after the specified duration.

Link copied to clipboard
fun <M : Mob> M.removeGoal(key: GoalKey<M>)

Removes a goal from this mob by its GoalKey.

fun <M : Mob> M.removeGoal(goal: Goal<M>)

Removes a specific goal instance from this mob.

Link copied to clipboard
fun LivingEntity.resistance(duration: Duration, amplifier: Int = 0)

Applies the Resistance effect to this entity.

Link copied to clipboard
fun LivingEntity.saturation(duration: Duration, amplifier: Int = 0)

Applies the Saturation effect to this entity.

Link copied to clipboard
inline operator fun <T : Any> PersistentDataEditor.set(key: NamespacedKey, value: T)

Stores a value in the container using the inferred type T.

Link copied to clipboard
fun Entity.setMetadata(plugin: JavaPlugin, key: String, value: Any)

Sets metadata on this entity with the specified key and value.

Link copied to clipboard
fun LivingEntity.slowFalling(duration: Duration, amplifier: Int = 0)

Applies the Slow Falling effect to this entity.

Link copied to clipboard
inline fun <E : Entity> Location.spawn(noinline editor: E.() -> Unit = {}): E

Spawns an entity of type E at this location.

fun Location.spawn(entity: EntityType, editor: Entity.() -> Unit = {}): Entity

Spawns an entity of the specified type at this location.

inline fun <E : Entity> World.spawn(location: Location, noinline editor: E.() -> Unit = {}): E

Spawns an entity of type E at the given location in this world.

fun World.spawn(entity: EntityType, location: Location, editor: Entity.() -> Unit = {}): Entity

Spawns an entity of the specified type at the given location in this world.

Link copied to clipboard
fun LivingEntity.speed(duration: Duration, amplifier: Int = 0)

Applies the Speed effect to this entity.

Link copied to clipboard
fun LivingEntity.strength(duration: Duration, amplifier: Int = 0)

Applies the Strength effect to this entity.

Link copied to clipboard
fun Mob.targetNearestPlayer(radius: Double = 10.0, filter: (Player) -> Boolean = { true }): Player?

Targets the nearest player within the specified radius.

Link copied to clipboard
fun LivingEntity.unluck(duration: Duration, amplifier: Int = 0)

Applies the Unluck effect to this entity.

Link copied to clipboard
fun LivingEntity.waterBreathing(duration: Duration, amplifier: Int = 0)

Applies the Water Breathing effect to this entity.

Link copied to clipboard
fun LivingEntity.weakness(duration: Duration, amplifier: Int = 0)

Applies the Weakness effect to this entity.

Link copied to clipboard
fun LivingEntity.wither(duration: Duration, amplifier: Int = 0)

Applies the Wither effect to this entity.