classSource
public final class EventBus

Constructors

public EventBus()

Methods

public <T extends Event> void post(T event)
Parameters
eventT
public <T extends Event> void subscribe(Class<T> type, EventListener<T> listener)
Example usage:
// replace SomeEvent with any event you'd like to listen to
eventBus.subscribe(SomeEvent.class, event -> {
    // Code here will get executed when the event gets triggered
});
Parameters
typeClass<T>
listenerEventListener<T>
public <T extends Event> void unsubscribe(Class<T> type, EventListener<T> listener)
Parameters
typeClass<T>
listenerEventListener<T>

Used by

Methods of other types that accept or return EventBus.