Interface ServerEventListener
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Callback invoked when a server connects to or disconnects from the
CommandBridge network.
This is a @FunctionalInterface and may be used as a lambda
expression. Register listeners via
CommandBridgeAPI.onServerConnected(ServerEventListener)
and
CommandBridgeAPI.onServerDisconnected(ServerEventListener).
Both methods return an Optional wrapping a
Subscription on the Velocity
proxy, and Optional.empty() on backend servers.
The listener receives the server that triggered the event:
server -> Log.info("Server {}: {}", server.id(), server.type())
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Platform.ServerTarget server) Invoked when a server connects or disconnects from the bridge network.
-
Method Details
-
accept
Invoked when a server connects or disconnects from the bridge network.- Parameters:
server- the server involved in the event, providing its unique identifier viaPlatform.ServerTarget.id()and its platform type viaPlatform.ServerTarget.type()
-