Interface PunishmentUser

All Known Implementing Classes:
PunishmentUserProvider

public sealed interface PunishmentUser permits PunishmentUserProvider
Represents a user who has been punished or is subject to a punishment.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    exists(int userId, int typeId)
    Checks if a record or punishment exists for a specific type and user.
    getCreatedAt(int userId, int typeId)
    Retrieves the timestamp representing when the entity associated with the specified type and user was created.
    int
    getCreatedBy(int userId, int typeId)
    Retrieves the identifier of the user who created a punishment record.
    long
    getDuration(int userId, int typeId)
    Retrieves the duration of a punishment for a specified type and user.
    getExpiredDate(int userId, int typeId)
    Retrieves the expiration date of a punishment for a specific user and type.
    long
    getExpiredTime(int userId, int typeId)
    Retrieves the expiration time of a punishment for a specific user and type.
    getLogId(int userId, int typeId)
    Retrieves the log identifier related to a specific type and user.
    getModifiedAt(int userId, int typeId)
    Retrieves the timestamp of the last modification made to the punishment details of a user specified by their type ID and user ID.
    int
    getModifiedBy(int userId, int typeId)
    Retrieves the ID of the user who last modified the punishment record.
    getReason(int userId, int typeId)
    Retrieves the reason associated with a specified type and user by their respective IDs.
    int
    getReasonId(int userId, int typeId)
    Retrieves the reason ID associated with the specified type and user ID.
    getUsers(int typeId)
    Retrieves a list of user IDs associated with the specified punishment type.
    boolean
    isPunished(int userId, int typeId)
    Determines whether the specified user is currently punished for the given type.
    void
    punish(int userId, int typeId, int executorId, InetAddress inetAddress, int reasonId)
    Applies a punishment to a user.
    void
    setExpiredTime(int userId, int typeId, int executorId, long time)
    Sets the expiration time for a punishment record.
    void
    setReasonId(int userId, int typeId, int executorId, int reasonId)
    Updates the reason associated with the punishment of a user.
    void
    unpunished(int userId, int typeId)
    Removes the punishment for the specified user and type.
  • Method Details

    • exists

      boolean exists(int userId, int typeId)
      Checks if a record or punishment exists for a specific type and user.
      Parameters:
      userId - The ID of the user to check for the existence of the record.
      typeId - The ID of the punishment type to check.
      Returns:
      true if the record exists, false otherwise.
    • punish

      void punish(int userId, int typeId, int executorId, InetAddress inetAddress, int reasonId)
      Applies a punishment to a user.
      Parameters:
      userId - The ID of the user being punished
      typeId - The ID representing the type of punishment
      executorId - The ID of the executor performing the punishment
      inetAddress - The network address associated with the user
      reasonId - The ID representing the reason for the punishment
    • unpunished

      void unpunished(int userId, int typeId)
      Removes the punishment for the specified user and type.
      Parameters:
      userId - The identifier of the user
      typeId - The identifier of the punishment type
    • getUsers

      List<Integer> getUsers(int typeId)
      Retrieves a list of user IDs associated with the specified punishment type.
      Parameters:
      typeId - The ID of the punishment type
      Returns:
      A list of user IDs associated with the specified punishment type
    • getLogId

      UUID getLogId(int userId, int typeId)
      Retrieves the log identifier related to a specific type and user.
      Parameters:
      userId - The unique identifier of the user.
      typeId - The type identifier associated with the user.
      Returns:
      The UUID representing the log identifier for the given type and user.
    • getReasonId

      int getReasonId(int userId, int typeId)
      Retrieves the reason ID associated with the specified type and user ID.
      Parameters:
      userId - The ID of the user for whom the reason ID is requested.
      typeId - The ID representing the type of punishment.
      Returns:
      The reason ID associated with the given type and user ID.
    • setReasonId

      void setReasonId(int userId, int typeId, int executorId, int reasonId)
      Updates the reason associated with the punishment of a user.
      Parameters:
      userId - The identifier of the user being punished.
      typeId - The type identifier of the punishment.
      executorId - The identifier of the executor making the change.
      reasonId - The identifier of the new reason for the punishment.
    • getReason

      String getReason(int userId, int typeId)
      Retrieves the reason associated with a specified type and user by their respective IDs.
      Parameters:
      userId - The ID representing the user associated with the punishment or action
      typeId - The ID representing the type of the punishment or action
      Returns:
      The reason as a string for the specified type and user
    • getDuration

      long getDuration(int userId, int typeId)
      Retrieves the duration of a punishment for a specified type and user.
      Parameters:
      userId - The ID of the user whose punishment duration is to be retrieved.
      typeId - The ID representing the type of punishment.
      Returns:
      The duration of the punishment in milliseconds.
    • getExpiredTime

      long getExpiredTime(int userId, int typeId)
      Retrieves the expiration time of a punishment for a specific user and type.
      Parameters:
      userId - The ID of the user associated with the punishment.
      typeId - The ID of the punishment type.
      Returns:
      The expiration time of the punishment as a timestamp in milliseconds.
    • getExpiredDate

      String getExpiredDate(int userId, int typeId)
      Retrieves the expiration date of a punishment for a specific user and type.
      Parameters:
      userId - The unique identifier of the user
      typeId - The unique identifier of the punishment type
      Returns:
      A string representing the expiration date of the punishment, or null if no expiration date is set
    • setExpiredTime

      void setExpiredTime(int userId, int typeId, int executorId, long time)
      Sets the expiration time for a punishment record.
      Parameters:
      userId - The identifier of the user being punished
      typeId - The type of punishment being set
      executorId - The identifier of the executor making the change
      time - The expiration time of the punishment, in milliseconds since epoch
    • isPunished

      boolean isPunished(int userId, int typeId)
      Determines whether the specified user is currently punished for the given type.
      Parameters:
      userId - The identifier of the user
      typeId - The identifier of the punishment type
      Returns:
      true if the user is currently punished for the specified type, false otherwise
    • getCreatedBy

      int getCreatedBy(int userId, int typeId)
      Retrieves the identifier of the user who created a punishment record.
      Parameters:
      userId - The ID of the affected user.
      typeId - The ID of the punishment type.
      Returns:
      The ID of the user who created the punishment.
    • getCreatedAt

      Timestamp getCreatedAt(int userId, int typeId)
      Retrieves the timestamp representing when the entity associated with the specified type and user was created.
      Parameters:
      userId - The ID of the user associated with the creation
      typeId - The ID of the type associated with the creation
      Returns:
      The creation timestamp of the associated type and user
    • getModifiedBy

      int getModifiedBy(int userId, int typeId)
      Retrieves the ID of the user who last modified the punishment record.
      Parameters:
      userId - The user identifier related to the punishment record
      typeId - The type identifier associated with the punishment record
      Returns:
      The ID of the user who last modified the punishment record
    • getModifiedAt

      Timestamp getModifiedAt(int userId, int typeId)
      Retrieves the timestamp of the last modification made to the punishment details of a user specified by their type ID and user ID.
      Parameters:
      userId - The unique identifier for the user
      typeId - The unique identifier for the punishment type
      Returns:
      A Timestamp representing the last modification time for the specified type and user