Package org.spongepowered.api.network
Interface EngineConnection
- All Superinterfaces:
RemoteConnection
- All Known Subinterfaces:
ClientSideConnection
,ServerSideConnection
Represents a connection on the server or client engine.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the connection, showing the default disconnect reason.void
Closes the connection with the given reason.EngineConnectionSide
<? extends EngineConnection> side()
Gets the side this connection is on.state()
Gets the state this connection is on.Methods inherited from interface org.spongepowered.api.network.RemoteConnection
active, address, virtualHost
-
Method Details
-
side
EngineConnectionSide<? extends EngineConnection> side()Gets the side this connection is on.- Returns:
- The side
-
state
Optional<EngineConnectionState> state()Gets the state this connection is on.- Returns:
- The state, or
Optional.empty()
if the connection has been closed.
-
close
void close()Closes the connection, showing the default disconnect reason. (the translation keydisconnect.disconnected
)- Specified by:
close
in interfaceRemoteConnection
-
close
Closes the connection with the given reason.- Parameters:
reason
- The reason for the disconnection
-