Package group24.escaperoom.data
Class User
java.lang.Object
group24.escaperoom.data.User
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UUIDprotected UUIDprotected PlayerRecordprotected String -
Method Summary
Modifier and TypeMethodDescriptionAttemptLogin(String username, String password) Using the Networking APIs, log the user in.createAccount(String username, String password) Using the Networking APIs, create a new user and log them in.static User.Credentialsstatic PlayerRecordhasAccount(String username) Using the Networking APIs, check if a user exists by checking their username.static booleanCheck if the user is logged in.static voidlogOut()
-
Field Details
-
username
-
player_id
-
access_key
-
record
-
-
Method Details
-
getRecord
-
getCredentials
-
AttemptLogin
public static CompletableFuture<Networking.StatusCode> AttemptLogin(String username, String password) Using the Networking APIs, log the user in. Operates in-place, so the user calling this function will be logged in if successful. Requires: - username - password Updates on success: - sets username - sets player_id - sets access_key ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
logOut
public static void logOut() -
createAccount
public static CompletableFuture<Networking.StatusCode> createAccount(String username, String password) Using the Networking APIs, create a new user and log them in. If a user with the name already exists, this function will fail Operates in-place, so the user calling this function will be logged in if successful. Requires: - username - password Updates on success: - clears password - sets player_id - sets access_key ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
hasAccount
Using the Networking APIs, check if a user exists by checking their username. Requires: - username ReturnsStatusCodefor success/fail handling: -StatusCode.OK: success - anything else: error -
isLoggedIn
public static boolean isLoggedIn()Check if the user is logged in.
-