Class AuthData
java.lang.Object
tk.airshipcraft.commonlib.db.model.AuthData
Represents the authentication data for a player, storing information related to the linkage of Minecraft accounts to Discord accounts. This class is used to verify if a player has successfully linked their accounts.
Authentication data is stored in a database table with the following schema:
CREATE TABLE IF NOT EXISTS auth_data ( id UUID PRIMARY KEY, IGN VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, token UUID NOT NULL, verified BOOLEAN NOT NULL ); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_IGN_index ON auth_data (IGN); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_username_index ON auth_data (username); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_token_index ON auth_data (token); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_verified_index ON auth_data (verified); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_IGN_username_index ON auth_data (IGN, username); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_IGN_token_index ON auth_data (IGN, token); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_IGN_verified_index ON auth_data (IGN, verified); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_username_token_index ON auth_data (username, token); CREATE UNIQUE INDEX IF NOT EXISTS auth_data_username_verified_index ON auth_data (username, verified);
- Since:
- 2024-01-05
- Version:
- 1.0.0
- Author:
- notzune
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the specified object is equal to this AuthData object.getId()
Returns the UUID of the player.getIGN()
Returns the in-game name of the player.getToken()
Returns the authentication token associated with the player.Returns the username associated with the player's Discord account.int
hashCode()
Returns the hash code of the AuthData object.boolean
Checks if the player's account is verified.void
Sets the UUID of the player.void
Sets the in-game name of the player.void
Sets the authentication token for the player.void
setUsername
(String username) Sets the username associated with the player's Discord account.void
setVerified
(boolean verified) Sets the verification status of the player's account.toString()
Returns a String representation of the AuthData object.
-
Constructor Details
-
AuthData
Constructs an AuthData object with the specified details.- Parameters:
uuid
- The UUID of the player.IGN
- The in-game name of the player.username
- The username associated with the Discord account.token
- The UUID token used for authentication.verified
- A boolean indicating if the player's account is verified.
-
-
Method Details
-
getId
Returns the UUID of the player.- Returns:
- A UUID representing the player's identity.
-
setId
Sets the UUID of the player.- Parameters:
id
- The UUID to set.
-
getIGN
Returns the in-game name of the player.- Returns:
- A String representing the player's in-game name.
-
setIGN
Sets the in-game name of the player.- Parameters:
IGN
- The in-game name to set.
-
getUsername
Returns the username associated with the player's Discord account.- Returns:
- A String representing the Discord username.
-
setUsername
Sets the username associated with the player's Discord account.- Parameters:
username
- The Discord username to set.
-
getToken
Returns the authentication token associated with the player.- Returns:
- A UUID token used for authentication purposes.
-
setToken
Sets the authentication token for the player.- Parameters:
token
- The UUID token to set.
-
isVerified
public boolean isVerified()Checks if the player's account is verified.- Returns:
- A boolean indicating the verification status.
-
setVerified
public void setVerified(boolean verified) Sets the verification status of the player's account.- Parameters:
verified
- The verification status to set.
-
toString
Returns a String representation of the AuthData object. -
equals
Checks if the specified object is equal to this AuthData object. -
hashCode
public int hashCode()Returns the hash code of the AuthData object.
-