Class EventHandler<T extends Event>
java.lang.Object
net.lucypoulton.squirtgun.platform.event.EventHandler<T>
- Type Parameters:
T- the event to handle
- All Implemented Interfaces:
Comparable<EventHandler<?>>
An event handler.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Event>
EventHandler.Builder<T>Creates a new builder.intcompareTo(@NotNull EventHandler<?> o)booleanThe type of event that this handler accepts.voidExecutes the handler.static <T extends Event>
EventHandler<T>Creates a new builder from a consumer, with event priorityEventPriority.NORMAL.booleanWhether this handler should be called if a handler with a higher priority has cancelled the event.priority()This handler's priority.
-
Method Details
-
eventType
The type of event that this handler accepts. -
priority
This handler's priority. -
executesOnCancel
public boolean executesOnCancel()Whether this handler should be called if a handler with a higher priority has cancelled the event. This value is not used with events that aren't cancellable. -
execute
Executes the handler. -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<T extends Event>
-
builder
Creates a new builder.- Type Parameters:
T- the type of event to listen for- Returns:
- a new builder
-
executes
Creates a new builder from a consumer, with event priorityEventPriority.NORMAL.- Type Parameters:
T- the event to handle- Parameters:
handler- the handler to execute
-