Interface ConnectionManager
public interface ConnectionManager
Handles injected UserConnections
-
Method Summary
Modifier and TypeMethodDescription@Nullable UserConnection
getConnectedClient
(UUID clientIdentifier) Returns the frontend UserConnection from the player connected to this proxy server Returns null when there isn't a server or connection was not found When ViaVersion is reloaded, this method may not return some players.@Nullable UUID
getConnectedClientId
(UserConnection connection) Returns the UUID from the frontend connection to this proxy server Returns null when there isn't a server or this connection isn't frontend, or it doesn't have an id When ViaVersion is reloaded, this method may not return some players.Returns a map containing the UUIDs and frontend UserConnections from players connected to this proxy server Returns empty list when there isn't a server When ViaVersion is reloaded, this method may not return some players.Returns all UserConnections which are registered May contain duplicated UUIDs on multiple ProtocolInfo.boolean
isClientConnected
(UUID playerId) Returns if Via injected into this player connection.default boolean
isFrontEnd
(UserConnection connection) Frontend connections will have the UUID stored.void
onDisconnect
(UserConnection connection) void
onLoginSuccess
(UserConnection connection)
-
Method Details
-
isClientConnected
Returns if Via injected into this player connection.- Parameters:
playerId
- player uuid- Returns:
- true if the player is handled by Via
-
isFrontEnd
Frontend connections will have the UUID stored. Override this if your platform isn't always frontend. UUIDs can't be duplicate between frontend connections.- Returns:
- true if the user is a frontend connection
-
getConnectedClient
Returns the frontend UserConnection from the player connected to this proxy server Returns null when there isn't a server or connection was not found When ViaVersion is reloaded, this method may not return some players.Note that connections are removed as soon as their channel is closed, so avoid using this method during player quits for example.
- Returns:
- frontend UserConnection of the player connected to this proxy server
-
getConnectedClientId
Returns the UUID from the frontend connection to this proxy server Returns null when there isn't a server or this connection isn't frontend, or it doesn't have an id When ViaVersion is reloaded, this method may not return some players.Note that connections are removed as soon as their channel is closed, so avoid using this method during player quits for example.
- Returns:
- UUID of the frontend connection to this proxy server
-
getConnections
Set<UserConnection> getConnections()Returns all UserConnections which are registered May contain duplicated UUIDs on multiple ProtocolInfo. May contain frontend, backend and/or client-sided connections. When ViaVersion is reloaded, this method may not return some players.- Returns:
- connected UserConnections
-
getConnectedClients
Map<UUID,UserConnection> getConnectedClients()Returns a map containing the UUIDs and frontend UserConnections from players connected to this proxy server Returns empty list when there isn't a server When ViaVersion is reloaded, this method may not return some players.- Returns:
- map containing the UUIDs and frontend UserConnections from players connected to this proxy server
-
onLoginSuccess
-
onDisconnect
-