Interface User

All Known Implementing Classes:
UserProvider

public sealed interface User permits UserProvider
User interface to manage users.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Creates a new user with the specified username if it does not already exist, or retrieves the ID of an existing user with the specified username.
    int
    Creates a new user with the specified UUID if it does not already exist, or retrieves the ID of an existing user associated with the specified UUID.
    void
    createUser(UUID uuid, String username)
    Creates a new user in the system based on the provided UUID and username.
    void
    Deletes a user associated with the specified UUID.
    boolean
    existsUser(String username)
    Checks if a user with the specified username exists.
    boolean
    Checks if a user with the specified UUID exists.
    getFirstJoinDate(int userId)
    Retrieves the first join date of a user as a formatted date string.
    getFirstJoinTime(int userId)
    Retrieves the first join time of a user in milliseconds since the epoch.
    int
    getId(String username)
    Retrieves the unique numeric ID of a user associated with the specified username.
    int
    getId(UUID uuid)
    Retrieves the unique numeric ID of a user associated with the specified UUID.
    Retrieves the parent information associated with the user.
    Retrieves the permission associated with a user.
    getUniqueId(int userId)
    Retrieves the unique identifier (UUID) associated with the specified user ID.
    getUniqueId(String username)
    Retrieves the unique identifier (UUID) associated with the specified username.
    Retrieves a list of unique identifiers (UUIDs) associated with all users.
    getUsername(int userId)
    Retrieves the username associated with the specified user ID.
    Retrieves the username associated with the specified UUID.
    Retrieves a list of usernames for all users.
    void
    joinUser(UUID uuid, String username)
    Joins the user identified by the specified UUID and username into the system.
    void
    Loads and processes expired user data in the system.
    void
    rename(int userId, String newUsername)
    Renames a user by updating the username associated with the given user ID.
    void
    rename(UUID uuid, String newUsername)
    Updates the username of the user associated with the specified UUID.
    void
    setFirstJoinTime(int userId)
    Sets the first join time for a user identified by the given user ID.
  • Method Details

    • createOrGetUser

      int createOrGetUser(String username)
      Creates a new user with the specified username if it does not already exist, or retrieves the ID of an existing user with the specified username.
      Parameters:
      username - The username of the user to create or retrieve
      Returns:
      The unique numeric ID of the newly created or existing user
    • createOrGetUser

      int createOrGetUser(UUID uuid)
      Creates a new user with the specified UUID if it does not already exist, or retrieves the ID of an existing user associated with the specified UUID.
      Parameters:
      uuid - The unique identifier of the user to create or retrieve
      Returns:
      The unique numeric ID of the newly created or existing user
    • existsUser

      boolean existsUser(UUID uuid)
      Checks if a user with the specified UUID exists.
      Parameters:
      uuid - The unique identifier of the user to check
      Returns:
      True if a user with the given UUID exists, false otherwise
    • existsUser

      boolean existsUser(String username)
      Checks if a user with the specified username exists.
      Parameters:
      username - The username of the user to check
      Returns:
      True if a user with the given username exists, false otherwise
    • createUser

      void createUser(UUID uuid, String username)
      Creates a new user in the system based on the provided UUID and username. If the user already exists, no new user will be created.
      Parameters:
      uuid - The unique identifier of the user to be created
      username - The username of the user to be created
    • deleteUser

      void deleteUser(UUID uuid)
      Deletes a user associated with the specified UUID.
      Parameters:
      uuid - The unique identifier of the user to be deleted
    • getId

      int getId(UUID uuid)
      Retrieves the unique numeric ID of a user associated with the specified UUID.
      Parameters:
      uuid - The unique identifier of the user whose ID is to be retrieved
      Returns:
      The unique numeric ID of the user associated with the given UUID
    • getId

      int getId(String username)
      Retrieves the unique numeric ID of a user associated with the specified username.
      Parameters:
      username - The username of the user whose ID is to be retrieved
      Returns:
      The unique numeric ID of the user associated with the given username
    • getUniqueId

      UUID getUniqueId(int userId)
      Retrieves the unique identifier (UUID) associated with the specified user ID. If no user exists with the given ID, the behavior may vary depending on the implementation.
      Parameters:
      userId - The unique numeric ID of the user
      Returns:
      The UUID associated with the specified user ID
    • getUniqueId

      UUID getUniqueId(String username)
      Retrieves the unique identifier (UUID) associated with the specified username. If no user exists with the given username, the behavior may vary depending on the implementation.
      Parameters:
      username - The username of the user whose UUID is to be retrieved
      Returns:
      The UUID associated with the specified username
    • getUsername

      String getUsername(int userId)
      Retrieves the username associated with the specified user ID.
      Parameters:
      userId - The unique numeric ID of the user whose username is to be retrieved
      Returns:
      The username associated with the given user ID
    • getUsername

      String getUsername(UUID uuid)
      Retrieves the username associated with the specified UUID.
      Parameters:
      uuid - The unique identifier of the user whose username is to be retrieved
      Returns:
      The username associated with the given UUID
    • rename

      void rename(int userId, String newUsername)
      Renames a user by updating the username associated with the given user ID.
      Parameters:
      userId - The unique numeric ID of the user whose username is to be updated
      newUsername - The new username to associate with the user
    • rename

      void rename(UUID uuid, String newUsername)
      Updates the username of the user associated with the specified UUID.
      Parameters:
      uuid - The unique identifier of the user to be updated
      newUsername - The new username to assign to the user
    • getUniqueIds

      List<UUID> getUniqueIds()
      Retrieves a list of unique identifiers (UUIDs) associated with all users.
      Returns:
      A list of UUIDs representing all users.
    • getUsernames

      List<String> getUsernames()
      Retrieves a list of usernames for all users.
      Returns:
      A list of usernames representing all users.
    • getFirstJoinTime

      Timestamp getFirstJoinTime(int userId)
      Retrieves the first join time of a user in milliseconds since the epoch.
      Parameters:
      userId - The unique numeric ID of the user
      Returns:
      The first join time of the user in milliseconds since January 1, 1970, 00:00:00 GMT
    • getFirstJoinDate

      String getFirstJoinDate(int userId)
      Retrieves the first join date of a user as a formatted date string.
      Parameters:
      userId - The unique numeric ID of the user whose first join date is to be retrieved
      Returns:
      A string representing the first join date of the user
    • setFirstJoinTime

      void setFirstJoinTime(int userId)
      Sets the first join time for a user identified by the given user ID.
      Parameters:
      userId - The unique numeric ID of the user whose first join time is to be set
    • joinUser

      void joinUser(UUID uuid, String username)
      Joins the user identified by the specified UUID and username into the system.
      Parameters:
      uuid - The unique identifier associated with the user to join
      username - The username of the user to join
    • loadExpired

      void loadExpired()
      Loads and processes expired user data in the system. This method handles expired or outdated user records, executing relevant operations such as cleanup, refresh, or other maintenance tasks depending on the specific implementation.
    • getParent

      UserParent getParent()
      Retrieves the parent information associated with the user.
      Returns:
      A UserParent object representing the parent information of the user.
    • getPermission

      UserPermission getPermission()
      Retrieves the permission associated with a user.
      Returns:
      The UserPermission object representing the user's permissions.