Interface ConnectionManager


public interface ConnectionManager
Handles injected UserConnections
  • Method Summary

    Modifier and Type
    Method
    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
    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
    Returns if Via injected into this player connection.
    default boolean
    Frontend connections will have the UUID stored.
    void
     
    void
     
  • Method Details

    • isClientConnected

      boolean isClientConnected(UUID playerId)
      Returns if Via injected into this player connection.
      Parameters:
      playerId - player uuid
      Returns:
      true if the player is handled by Via
    • isFrontEnd

      default boolean isFrontEnd(UserConnection connection)
      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

      @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.

      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

      @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.

      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

      void onLoginSuccess(UserConnection connection)
    • onDisconnect

      void onDisconnect(UserConnection connection)