Package me.tamkungz.nilkit.event
Class EventBus
java.lang.Object
me.tamkungz.nilkit.event.EventBus
Simple Forge/Fabric-like event bus for NilKit.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all listeners from this bus.boolean<T extends Event>
voidregister(Class<T> eventType, EventBus.EventListener<T> listener) <T extends Event>
voidregister(Class<T> eventType, EventBus.EventListener<T> listener, EventPriority priority, boolean receiveCancelled) voidRegisters all validSubscribeEventmethods on a listener instance.<T extends Event>
voidunregister(Class<T> eventType, EventBus.EventListener<T> listener) Removes a typed callback previously registered withregister(Class, EventListener).voidunregister(Object listener) Removes all annotated handlers owned by the listener instance.
-
Constructor Details
-
EventBus
public EventBus()
-
-
Method Details
-
register
Registers all validSubscribeEventmethods on a listener instance. Inherited listener methods are supported. Registering the same listener twice is idempotent. -
register
-
register
public <T extends Event> void register(Class<T> eventType, EventBus.EventListener<T> listener, EventPriority priority, boolean receiveCancelled) -
unregister
Removes all annotated handlers owned by the listener instance. -
unregister
Removes a typed callback previously registered withregister(Class, EventListener). -
clear
public void clear()Removes all listeners from this bus. -
post
-