Interface MinecraftSessionService

All Known Implementing Classes:
YggdrasilMinecraftSessionService

public interface MinecraftSessionService
  • Method Details

    • joinServer

      void joinServer(UUID profileId, String authenticationToken, String serverId) throws AuthenticationException
      Attempts to join the specified Minecraft server.

      If this method returns without throwing an exception, the join was successful and a subsequent call to hasJoinedServer(String, String, InetAddress) will return true.

      Parameters:
      profileId - The player profile ID to join as
      authenticationToken - The authenticated token of the user
      serverId - The random ID of the server to join
      Throws:
      AuthenticationUnavailableException - Thrown when the servers return a malformed response, or are otherwise unavailable
      InvalidCredentialsException - Thrown when the specified authenticationToken is invalid
      AuthenticationException - Generic exception indicating that we could not authenticate the user
    • hasJoinedServer

      @Nullable ProfileResult hasJoinedServer(String profileName, String serverId, @Nullable InetAddress address) throws AuthenticationUnavailableException
      Checks if the specified user has joined a Minecraft server.

      Parameters:
      profileName - The player name to check for
      serverId - The random ID of the server to check for
      address - The address connected from
      Returns:
      Full game profile if the user had joined, otherwise null
      Throws:
      AuthenticationUnavailableException - Thrown when the servers return a malformed response, or are otherwise unavailable
    • getPackedTextures

      @Nullable Property getPackedTextures(GameProfile profile)
      Gets the packed property representation of any textures contained in the given profile.
      Parameters:
      profile - the profile to get textures from
      Returns:
      the packed property containing texture data, or null if this profile does not have any
      See Also:
    • unpackTextures

      MinecraftProfileTextures unpackTextures(Property packedTextures)
      Unpacks the texture data contained in the given packed profile property.
      Parameters:
      packedTextures - the raw texture data to unpack
      Returns:
      the unpacked set of textures, or MinecraftProfileTextures.EMPTY if the data was malformed
      See Also:
    • getTextures

      default MinecraftProfileTextures getTextures(GameProfile profile)
      Gets and unpacks any textures contains in the given profile.
      Parameters:
      profile - the profile to get textures from
      Returns:
      the unpacked set of textures, or MinecraftProfileTextures.EMPTY if the data was missing or malformed
      See Also:
    • fetchProfile

      @Nullable ProfileResult fetchProfile(UUID profileId, boolean requireSecure)
      Fetches the profile information associated with the given ID from the session service. This will include all properties associated with the profile.

      The profile must have an ID. If no information is found, nothing will be done.

      Parameters:
      profileId - The ID of the game profile to request.
      requireSecure - If the profile property map should include verifiable signature information.
      Returns:
      Fetched profile for the requested user, or null if unsuccessful or the user did not exist.
    • getSecurePropertyValue

      String getSecurePropertyValue(Property property) throws InsecurePublicKeyException
      Verifies the signature and returns the value of a Property.
      Parameters:
      property - Property to return the value of.
      Returns:
      String value
      Throws:
      InsecurePublicKeyException - If data is insecure or missing