Package dev.comfast.experimental.events
Class EventsManager<EventContext>
java.lang.Object
dev.comfast.experimental.events.EventsManager<EventContext>
- Type Parameters:
EventContext- Class which will be passed in every event.
Manager for events. Please use
EventsApi.get(String, Class) to create instances of this class.-
Method Summary
Modifier and TypeMethodDescriptionvoidaction(BeforeEvent<EventContext> event, Runnable actionFunc)<T> Taction(BeforeEvent<EventContext> beforeEvent, Supplier<T> actionFunc)Calls all listeners before and after action.voidaddListener(String listenerName, EventListener<EventContext> listener)voidremoveListener(String name)
-
Method Details
-
addListener
-
removeListener
-
action
- See Also:
action(BeforeEvent, Supplier)
-
action
Calls all listeners before and after action.- Type Parameters:
T- type of action result- Parameters:
beforeEvent- new instance of BeforeEvent. Created it just before action call.actionFunc- action to call- Returns:
- action result
-