Interface ConnectionManager


  • public interface ConnectionManager
    Handles injected UserConnections
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      @Nullable UserConnection getConnectedClient​(java.util.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 java.util.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.
      java.util.Map<java.util.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.
      java.util.Set<UserConnection> getConnections()
      Returns all UserConnections which are registered May contain duplicated UUIDs on multiple ProtocolInfo.
      boolean isClientConnected​(java.util.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 Detail

      • isClientConnected

        boolean isClientConnected​(java.util.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​(java.util.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. May not return ProtocolSupport 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 java.util.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. May not return ProtocolSupport 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

        java.util.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. May not contain ProtocolSupport players.
        Returns:
        connected UserConnections
      • getConnectedClients

        java.util.Map<java.util.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. May not contain ProtocolSupport players.
        Returns:
        map containing the UUIDs and frontend UserConnections from players connected to this proxy server