Package meteordevelopment.orbit
Class EventBus
- java.lang.Object
-
- meteordevelopment.orbit.EventBus
-
-
Constructor Summary
Constructors Constructor Description EventBus()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tpost(T event)Posts an event to all subscribed event listeners.voidregisterLambdaFactory(java.lang.String packagePrefix, LambdaListener.Factory factory)Registers a lambda factory to use with the specified package.voidsubscribe(java.lang.Class<?> klass)Finds all correct (static only) methods withEventHandlerannotation and subscribes them.voidsubscribe(java.lang.Object object)Finds all correct (static and non-static) methods withEventHandlerannotation and subscribes them.voidsubscribe(IListener listener)Subscribes the listener (both static and non-static).voidunsubscribe(java.lang.Class<?> klass)Finds all correct (static only) methods withEventHandlerannotation and unsubscribes them.voidunsubscribe(java.lang.Object object)Finds all correct (static and non-static) methods withEventHandlerannotation and unsubscribes them.voidunsubscribe(IListener listener)Unsubscribes the listener (both static and non-static).
-
-
-
Method Detail
-
registerLambdaFactory
public void registerLambdaFactory(java.lang.String packagePrefix, LambdaListener.Factory factory)Description copied from interface:IEventBusRegisters a lambda factory to use with the specified package.- Specified by:
registerLambdaFactoryin interfaceIEventBus- Parameters:
packagePrefix- Package prefix that this factory will be used for, eg "meteordevelopment.orbit"factory- The factory to use
-
post
public <T> T post(T event)
Description copied from interface:IEventBusPosts an event to all subscribed event listeners.
-
post
public <T extends ICancellable> T post(T event)
Description copied from interface:IEventBusPosts a cancellable event to all subscribed event listeners. Stops after the event was cancelled.
-
subscribe
public void subscribe(java.lang.Object object)
Description copied from interface:IEventBusFinds all correct (static and non-static) methods withEventHandlerannotation and subscribes them.
-
subscribe
public void subscribe(java.lang.Class<?> klass)
Description copied from interface:IEventBusFinds all correct (static only) methods withEventHandlerannotation and subscribes them.
-
subscribe
public void subscribe(IListener listener)
Description copied from interface:IEventBusSubscribes the listener (both static and non-static).
-
unsubscribe
public void unsubscribe(java.lang.Object object)
Description copied from interface:IEventBusFinds all correct (static and non-static) methods withEventHandlerannotation and unsubscribes them.- Specified by:
unsubscribein interfaceIEventBus- Parameters:
object- The object to scan for methods
-
unsubscribe
public void unsubscribe(java.lang.Class<?> klass)
Description copied from interface:IEventBusFinds all correct (static only) methods withEventHandlerannotation and unsubscribes them.- Specified by:
unsubscribein interfaceIEventBus- Parameters:
klass- The class to scan for methods
-
unsubscribe
public void unsubscribe(IListener listener)
Description copied from interface:IEventBusUnsubscribes the listener (both static and non-static).- Specified by:
unsubscribein interfaceIEventBus- Parameters:
listener- Listener to unsubscribe
-
-