public class ViaConnectionManager extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<UUID,UserConnection> |
clients |
protected Set<UserConnection> |
connections |
Constructor and Description |
---|
ViaConnectionManager() |
Modifier and Type | Method and Description |
---|---|
@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 conn)
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.
|
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.
|
Set<UserConnection> |
getConnections()
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.
|
boolean |
isFrontEnd(UserConnection conn)
Frontend connections will have the UUID stored.
|
void |
onDisconnect(UserConnection connection) |
void |
onLoginSuccess(UserConnection connection) |
protected final Map<UUID,UserConnection> clients
protected final Set<UserConnection> connections
public void onLoginSuccess(UserConnection connection)
public void onDisconnect(UserConnection connection)
public boolean isFrontEnd(UserConnection conn)
public Map<UUID,UserConnection> getConnectedClients()
@Nullable public @Nullable UserConnection getConnectedClient(UUID clientIdentifier)
Note that connections are removed as soon as their channel is closed, so avoid using this method during player quits for example.
@Nullable public @Nullable UUID getConnectedClientId(UserConnection conn)
Note that connections are removed as soon as their channel is closed, so avoid using this method during player quits for example.
public Set<UserConnection> getConnections()
public boolean isClientConnected(UUID playerId)
playerId
- player uuidCopyright © 2016–2021. All rights reserved.