onEntity

open override fun onEntity(entity: Entity, onRetire: () -> Unit): SchedulingContext

Runs a task on a specific entity.

If the entity is not Entity.isValid before the given task is run, onRetire is called. Therefore, it is guaranteed that entity is Entity.isValid when tasks are run.