T - A generic type representing the kind of event that this listener
acceptspublic interface IEventListener<T extends Event>
Event objects being fired once
they have been registered into the IEventHandler using IEventHandler.registerListener(Class, IEventListener).| Modifier and Type | Method | Description |
|---|---|---|
EventResult |
listen(EventResult result,
T event) |
This method is called whenever the event that this listener listens to is
fired.
|
EventResult listen(EventResult result, T event)
EventResult.DEFAULT by default, but which can be changed by other
listeners that are in the queue before this one returning a different
EventResult in their listen method. Generally, if you
don't change the event result, yourself, you should always return the
result parameter that you are given rather than just EventResult.DEFAULT.
Returning EventResult.CANCELLED will cancel any event's listening
process, meaning the queue of listeners will be cleared so that listeners
later in the queue will not listen to this event.
result - The event result of the previous listener. This should be
passed on if the event's result should not be changedevent - The actual event instance that can be checked or modified.
Generally speaking, if an event has parameters that are
non-final, they can be changed by the event
listener to change the outcome of the event.