Interface MinecraftSessionService
- All Known Implementing Classes:
YggdrasilMinecraftSessionService
public interface MinecraftSessionService
-
Method Summary
Modifier and TypeMethodDescriptionfetchProfile(UUID profileId, boolean requireSecure) Fetches the profile information associated with the given ID from the session service.getPackedTextures(GameProfile profile) Gets the packed property representation of any textures contained in the given profile.getSecurePropertyValue(Property property) Verifies the signature and returns the value of aProperty.default MinecraftProfileTexturesgetTextures(GameProfile profile) Gets and unpacks any textures contains in the given profile.hasJoinedServer(String profileName, String serverId, InetAddress address) Checks if the specified user has joined a Minecraft server.voidjoinServer(UUID profileId, String authenticationToken, String serverId) Attempts to join the specified Minecraft server.unpackTextures(Property packedTextures) Unpacks the texture data contained in the given packed profile property.
-
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 tohasJoinedServer(String, String, InetAddress)will return true.- Parameters:
profileId- The player profile ID to join asauthenticationToken- The authenticated token of the userserverId- The random ID of the server to join- Throws:
AuthenticationUnavailableException- Thrown when the servers return a malformed response, or are otherwise unavailableInvalidCredentialsException- Thrown when the specified authenticationToken is invalidAuthenticationException- 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 forserverId- The random ID of the server to check foraddress- 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
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
nullif this profile does not have any - See Also:
-
unpackTextures
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.EMPTYif the data was malformed - See Also:
-
getTextures
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.EMPTYif the data was missing or malformed - See Also:
-
fetchProfile
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
nullif unsuccessful or the user did not exist.
-
getSecurePropertyValue
Verifies the signature and returns the value of aProperty.- Parameters:
property- Property to return the value of.- Returns:
- String value
- Throws:
InsecurePublicKeyException- If data is insecure or missing
-