Package meteordevelopment.orbit
Interface IEventBus
-
- All Known Implementing Classes:
EventBus
public interface IEventBusManages event listeners.
-
-
Method Summary
All Methods Instance Methods Abstract 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
void registerLambdaFactory(java.lang.String packagePrefix, LambdaListener.Factory factory)Registers a lambda factory to use with the specified package.- Parameters:
packagePrefix- Package prefix that this factory will be used for, eg "meteordevelopment.orbit"factory- The factory to use
-
post
<T> T post(T event)
Posts an event to all subscribed event listeners.- Type Parameters:
T- Type of the event- Parameters:
event- Event to post- Returns:
- Event passed in
-
post
<T extends ICancellable> T post(T event)
Posts a cancellable event to all subscribed event listeners. Stops after the event was cancelled.- Type Parameters:
T- Type of the event- Parameters:
event- Event to post- Returns:
- Event passed in
-
subscribe
void subscribe(java.lang.Object object)
Finds all correct (static and non-static) methods withEventHandlerannotation and subscribes them.- Parameters:
object- The object to scan for methods
-
subscribe
void subscribe(java.lang.Class<?> klass)
Finds all correct (static only) methods withEventHandlerannotation and subscribes them.- Parameters:
klass- The class to scan for methods
-
subscribe
void subscribe(IListener listener)
Subscribes the listener (both static and non-static).- Parameters:
listener- Listener to subscribe
-
unsubscribe
void unsubscribe(java.lang.Object object)
Finds all correct (static and non-static) methods withEventHandlerannotation and unsubscribes them.- Parameters:
object- The object to scan for methods
-
unsubscribe
void unsubscribe(java.lang.Class<?> klass)
Finds all correct (static only) methods withEventHandlerannotation and unsubscribes them.- Parameters:
klass- The class to scan for methods
-
unsubscribe
void unsubscribe(IListener listener)
Unsubscribes the listener (both static and non-static).- Parameters:
listener- Listener to unsubscribe
-
-