Package org.geysermc.mcprotocollib.auth
Class SessionService
java.lang.Object
org.geysermc.mcprotocollib.auth.SessionService
Service used for session-related queries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfillProfileProperties(GameProfile profile) Fills in the properties of a profile.getProfileByServer(String name, String serverId) Gets the profile of the given user if they are currently logged in to the given server.getProxy()static StringgetServerId(String base, PublicKey publicKey, SecretKey secretKey) Calculates the server ID from a base string, public key, and secret key.voidjoinServer(GameProfile profile, String authenticationToken, String serverId) Joins a server.voidtoString()
-
Constructor Details
-
SessionService
public SessionService()
-
-
Method Details
-
getServerId
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
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
Fills in the properties of a profile.- Parameters:
profile- Profile to fill in the properties of.- Throws:
IOException- If the property lookup fails.
-
toString
-
setProxy
-
getProxy
-