subscribe
Registers all instance methods on subscriber annotated with @Subscribe.
Methods handling event types outside of the E hierarchy are silently ignored at dispatch time; the underlying bus only invokes handlers whose registered type matches the posted event.
Use unsubscribe with the same instance to remove these handlers.
abstract fun <T : E> subscribe(eventClass: Class<T>, priority: Int, handler: (T) -> Unit): Subscription
Registers a lambda handler for event type T and returns a Subscription token. Hidden from Java; Java callers use the java.util.function.Consumer overload.
Registers a java.util.function.Consumer handler for event type T and returns a Subscription token for removal.
Java callers use plain void lambdas:
networkBus.subscribe(PacketReceived.class, Priority.NORMAL, e -> handle(e.bytes));Content copied to clipboard
Kotlin callers should use the reified extension instead.