EntityTracking

Global bookkeeper for storing which players are tracking some specific entities.

Entities must be manually registered and unregistered in order to provide tracking information on them. Call register before an entity is spawned, and call unregister

Functions

Link copied to clipboard
fun onTrack(entity: Entity): EventDispatch<Player>

Gets the event dispatcher that runs when the specified entity starts being tracked by a player.

Link copied to clipboard
fun onUntrack(entity: Entity): EventDispatch<Player>

Gets the event dispatcher that runs when the specified entity stops being tracked by a player.

Link copied to clipboard
fun register(entity: Entity)

The entity provided will be tracked by this object, allowing you to access API on this entity. You must manually unregister this entity when it is no longer valid!

Link copied to clipboard
fun trackedPlayers(entityId: UUID): Collection<Player>

Gets the players tracked by an entity with the specified ID.

fun trackedPlayers(entity: Entity): Collection<Player>

Gets the players tracked by the specified entity.

Link copied to clipboard
fun unregister(entityId: UUID)

The entity with the ID provided will no longer be tracked by this object, cleaning up memory and preventing using the API on this entity. This must be manually run after register.

fun unregister(entity: Entity)

The entity provided will no longer be tracked by this object, cleaning up memory and preventing using the API on this entity. This must be manually run after register.