Class EventBus
java.lang.Object
com.sk89q.worldedit.util.eventbus.EventBus
Dispatches events to listeners, and provides ways for listeners to register
 themselves.
 
This class is based on Guava's EventBus but priority is supported
 and events are dispatched at the time of call, rather than being queued up.
 This does allow dispatching during an in-progress dispatch.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidPosts an event to all registered handlers.voidRegisters all handler methods onobjectto receive events.voidsubscribe(Class<?> clazz, EventHandler handler) Registers the given handler for the given class to receive events.voidsubscribeAll(com.google.common.collect.Multimap<Class<?>, EventHandler> handlers) Registers the given handler for the given class to receive events.voidunregister(Object object) Unregisters all handler methods on a registeredobject.voidunsubscribe(Class<?> clazz, EventHandler handler) Unregisters the given handler for the given class.voidunsubscribeAll(com.google.common.collect.Multimap<Class<?>, EventHandler> handlers) Unregisters the given handlers.
- 
Constructor Details- 
EventBuspublic EventBus()
 
- 
- 
Method Details- 
subscribeRegisters the given handler for the given class to receive events.- Parameters:
- clazz- the event class to register
- handler- the handler to register
 
- 
subscribeAllRegisters the given handler for the given class to receive events.- Parameters:
- handlers- a map of handlers
 
- 
unsubscribeUnregisters the given handler for the given class.- Parameters:
- clazz- the class
- handler- the handler
 
- 
unsubscribeAllUnregisters the given handlers.- Parameters:
- handlers- a map of handlers
 
- 
registerRegisters all handler methods onobjectto receive events. Handler methods are selected and classified using this EventBus'sSubscriberFindingStrategy; the default strategy is theAnnotatedSubscriberFinder.- Parameters:
- object- object whose handler methods should be registered.
 
- 
unregisterUnregisters all handler methods on a registeredobject.- Parameters:
- object- object whose handler methods should be unregistered.
- Throws:
- IllegalArgumentException- if the object was not previously registered.
 
- 
postPosts an event to all registered handlers. This method will return successfully after the event has been posted to all handlers, and regardless of any exceptions thrown by handlers.- Parameters:
- event- event to post.
 
 
-