Class AuthData

java.lang.Object
tk.airshipcraft.commonlib.db.model.AuthData

public class AuthData extends Object

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
    Constructor
    Description
    AuthData(UUID uuid, String IGN, String username, UUID token, boolean verified)
    Constructs an AuthData object with the specified details.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if the specified object is equal to this AuthData object.
    Returns the UUID of the player.
    Returns the in-game name of the player.
    Returns the authentication token associated with the player.
    Returns the username associated with the player's Discord account.
    int
    Returns the hash code of the AuthData object.
    boolean
    Checks if the player's account is verified.
    void
    setId(UUID id)
    Sets the UUID of the player.
    void
    Sets the in-game name of the player.
    void
    setToken(UUID token)
    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.
    Returns a String representation of the AuthData object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AuthData

      public AuthData(UUID uuid, String IGN, String username, UUID token, boolean verified)
      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

      public UUID getId()
      Returns the UUID of the player.
      Returns:
      A UUID representing the player's identity.
    • setId

      public void setId(UUID id)
      Sets the UUID of the player.
      Parameters:
      id - The UUID to set.
    • getIGN

      public String getIGN()
      Returns the in-game name of the player.
      Returns:
      A String representing the player's in-game name.
    • setIGN

      public void setIGN(String IGN)
      Sets the in-game name of the player.
      Parameters:
      IGN - The in-game name to set.
    • getUsername

      public String getUsername()
      Returns the username associated with the player's Discord account.
      Returns:
      A String representing the Discord username.
    • setUsername

      public void setUsername(String username)
      Sets the username associated with the player's Discord account.
      Parameters:
      username - The Discord username to set.
    • getToken

      public UUID getToken()
      Returns the authentication token associated with the player.
      Returns:
      A UUID token used for authentication purposes.
    • setToken

      public void setToken(UUID token)
      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

      public String toString()
      Returns a String representation of the AuthData object.
      Overrides:
      toString in class Object
      Returns:
      A String representation of the AuthData object.
    • equals

      public boolean equals(Object obj)
      Checks if the specified object is equal to this AuthData object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare to.
      Returns:
      True if the objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash code of the AuthData object.
      Overrides:
      hashCode in class Object
      Returns:
      An integer representing the hash code.