Interface ConnectionManager


public interface ConnectionManager
Handles injected UserConnections. Check UserConnection.isServerSide() and UserConnection.isClientSide() to determine the connection type.
  • Method Details

    • hasServerConnection

      boolean hasServerConnection(UUID uuid)
      Returns if Via has injected. See above for the connection types.
      Parameters:
      uuid - player uuid
      Returns:
      true if the player is handled by Via
    • isClientConnected

      @Deprecated default boolean isClientConnected(UUID uuid)
      Deprecated.
    • hasClientConnection

      boolean hasClientConnection(UUID uuid)
      Returns if Via has injected. See above for the connection types.
      Parameters:
      uuid - player uuid
      Returns:
      true if the player is handled by Via
    • getServerConnection

      @Nullable UserConnection getServerConnection(UUID uuid)
      Returns the server UserConnection. See above for the connection types. 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:
      server UserConnection of the player or null
    • getConnectedClient

      @Deprecated default @Nullable UserConnection getConnectedClient(UUID uuid)
      Deprecated.
    • getClientConnection

      @Nullable UserConnection getClientConnection(UUID uuid)
      Returns the client UserConnection. See above for the connection types. 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:
      client UserConnection of the player or null
    • getServerConnections

      Map<UUID,UserConnection> getServerConnections()
      Returns a map containing the UUIDs and server UserConnections When ViaVersion is reloaded, this method may not return some players.
      Returns:
      map containing the UUIDs and frontend UserConnections
    • getConnectedClients

      @Deprecated default Map<UUID,UserConnection> getConnectedClients()
      Deprecated.
    • getClientConnections

      Map<UUID,UserConnection> getClientConnections()
      Returns a map containing the UUIDs and client UserConnections When ViaVersion is reloaded, this method may not return some players.
      Returns:
      map containing the UUIDs and client UserConnections
    • 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
    • onLoginSuccess

      void onLoginSuccess(UserConnection connection)
    • onDisconnect

      void onDisconnect(UserConnection connection)