Listeners can be registered to a subsciber.
EventBus eventBus = new EventBus();
Subscriber subscriber = new Subscriber();
eventBus.subscribe(subscriber);
// Assuming you've already defined a listener
subscriber.registerListener(new ExampleListener());
Or directly to an event bus.
EventBus eventBus = new EventBus();
// Assuming you've already defined a listener
eventBus.register(new ExampleListener());
Listeners can be registered to a subsciber.
EventBus eventBus = new EventBus();
Subscriber subscriber = new Subscriber();
eventBus.subscribe(subscriber);
subscriber.registerListener(
new LambdaEventListener<>(
Target.fine(MessageEvent.class),
event -> {/*...*/}
)
);
Or directly to an event bus.
EventBus eventBus = new EventBus();
eventBus.register(
new LambdaEventListener<>(
Target.fine(MessageEvent.class),
event -> {/*...*/}
)
);