Skip to content
Greg edited this page Jan 26, 2022 · 6 revisions
entity.events.emit(Event(data))

// Global scope
on<Entity, Event>({ condition && isMet }, Priority.HIGH) {
}

// Local scope
val listener = entity.events.on<Entity, Event>({ condition && isMet }, Priority.HIGH) {
}

// Important to remove listeners in local scope to prevent leaking memory
entity.events.remove(listener)
Clone this wiki locally