Class SessionService

java.lang.Object
org.geysermc.mcprotocollib.auth.SessionService

public class SessionService extends Object
Service used for session-related queries.
  • Constructor Details

    • SessionService

      public SessionService()
  • Method Details

    • getServerId

      public static String getServerId(String base, PublicKey publicKey, SecretKey secretKey)
      Calculates the server ID from a base string, public key, and secret key.
      Parameters:
      base - Base server ID to use.
      publicKey - Public key to use.
      secretKey - Secret key to use.
      Returns:
      The calculated server ID.
      Throws:
      IllegalStateException - If the server ID hash algorithm is unavailable.
    • joinServer

      public void joinServer(GameProfile profile, String authenticationToken, String serverId) throws IOException
      Joins a server.
      Parameters:
      profile - Profile to join the server with.
      authenticationToken - Authentication token to join the server with.
      serverId - ID of the server to join.
      Throws:
      IOException - If an error occurs while making the request.
    • getProfileByServer

      public GameProfile getProfileByServer(String name, String serverId) throws IOException
      Gets the profile of the given user if they are currently logged in to the given server.
      Parameters:
      name - Name of the user to get the profile of.
      serverId - ID of the server to check if they're logged in to.
      Returns:
      The profile of the given user, or null if they are not logged in to the given server.
      Throws:
      IOException - If an error occurs while making the request.
    • fillProfileProperties

      public void fillProfileProperties(GameProfile profile) throws IOException
      Fills in the properties of a profile.
      Parameters:
      profile - Profile to fill in the properties of.
      Throws:
      IOException - If the property lookup fails.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setProxy

      public void setProxy(ProxyInfo proxy)
    • getProxy

      public ProxyInfo getProxy()