public class EventBus extends java.lang.Object implements IEventExceptionHandler
Modifier and Type | Field and Description |
---|---|
private int |
busID |
private IEventExceptionHandler |
exceptionHandler |
private java.util.Map<java.lang.Object,ModContainer> |
listenerOwners |
private java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.ArrayList<IEventListener>> |
listeners |
private static int |
maxID |
private boolean |
shutdown |
Constructor and Description |
---|
EventBus() |
EventBus(IEventExceptionHandler handler) |
Modifier and Type | Method and Description |
---|---|
void |
handleException(EventBus bus,
Event event,
IEventListener[] listeners,
int index,
java.lang.Throwable throwable)
Fired when a EventListener throws an exception for the specified event on the event bus.
|
boolean |
post(Event event) |
private void |
register(java.lang.Class<?> eventType,
java.lang.Object target,
java.lang.reflect.Method method,
ModContainer owner) |
void |
register(java.lang.Object target) |
void |
shutdown() |
void |
unregister(java.lang.Object object) |
private static int maxID
private java.util.concurrent.ConcurrentHashMap<java.lang.Object,java.util.ArrayList<IEventListener>> listeners
private java.util.Map<java.lang.Object,ModContainer> listenerOwners
private final int busID
private IEventExceptionHandler exceptionHandler
private boolean shutdown
public EventBus()
public EventBus(@Nonnull IEventExceptionHandler handler)
public void register(java.lang.Object target)
private void register(java.lang.Class<?> eventType, java.lang.Object target, java.lang.reflect.Method method, ModContainer owner)
public void unregister(java.lang.Object object)
public boolean post(Event event)
public void shutdown()
public void handleException(EventBus bus, Event event, IEventListener[] listeners, int index, java.lang.Throwable throwable)
IEventExceptionHandler
handleException
in interface IEventExceptionHandler
bus
- The bus the event is being fired onevent
- The event that is being firedlisteners
- All listeners that are listening for this event, in orderindex
- Index for the current listener being fired.throwable
- The throwable being thrown