Interface PunishmentLog

All Known Implementing Classes:
PunishmentLogProvider

public sealed interface PunishmentLog permits PunishmentLogProvider
Represents a punishment log entry in the system.

A punishment log is a record of a punishment action taken against a user or IP address. The log entry contains information such as the type of punishment, the reason for the punishment, the expiration time of the punishment, and the user who executed the punishment.

Each punishment log entry is uniquely identified by a UUID and is associated with a specific user or IP address. The log entry can be used to track the history of punishments applied to a user or IP address over time.

  • Method Summary

    Modifier and Type
    Method
    Description
    addLogIp(int executorId, int typeId, InetAddress inetAddress, int reasonId)
    Adds a punishment log associated with an IP address to the system.
    addLogUser(int executorId, int typeId, int userId, InetAddress inetAddress, int reasonId)
    Adds a new log entry for a user to the punishment log.
    void
    deleteUserLogs(int userId)
    Deletes all logs associated with the specified user.
    boolean
    existsLog(UUID logId, int typeId)
    Checks if a log entry exists based on the specified log ID and type ID.
    getCreatedAt(UUID logId, int typeId)
    Retrieves the timestamp at which a punishment log was created.
    int
    getCreatedBy(UUID logId, int typeId)
    Retrieves the ID of the user or entity that created the specified punishment log entry.
    getExpiredDate(UUID logId, int typeId)
    Retrieves the expiration date of a punishment log as a string.
    long
    getExpiredTime(UUID logId, int typeId)
    Retrieves the expiration time for a specific punishment log entry.
    getIpAddress(UUID logId, int typeId)
    Retrieves the IP address associated with a specific punishment log.
    getLogs(int userId, int typeId)
    Retrieves a list of log identifiers associated with the specified user and punishment type.
    getLogs(InetAddress inetAddress, int typeId)
    Retrieves a list of log identifiers associated with a specific IP address and type.
    getModifiedAt(UUID logId, int typeId)
    Retrieves the timestamp of when the specified punishment log was last modified.
    int
    getModifiedBy(UUID logId, int typeId)
    Retrieves the ID of the user who last modified the punishment log entry.
    int
    getReasonId(UUID logId, int typeId)
    Retrieves the reason ID associated with a specific punishment log entry.
    int
    getUserId(UUID logId, int typeId)
    Retrieves the user ID associated with a specific punishment log.
    boolean
    isExpired(UUID logId, int typeId)
    Determines if the punishment log entry associated with the specified log ID and type ID is expired.
    setExpiredTime(UUID logId, int typeId, int executorId, long duration)
    Sets the expiration time for a specific punishment log entry.
    void
    setReasonId(UUID logId, int typeId, int executorId, int reasonId)
    Updates the reason ID for a specific punishment log entry.
  • Method Details

    • existsLog

      boolean existsLog(UUID logId, int typeId)
      Checks if a log entry exists based on the specified log ID and type ID.
      Parameters:
      logId - The unique identifier of the log entry
      typeId - The identifier for the type of the log entry
      Returns:
      true if a log entry with the given log ID and type ID exists, otherwise false
    • addLogIp

      UUID addLogIp(int executorId, int typeId, InetAddress inetAddress, int reasonId)
      Adds a punishment log associated with an IP address to the system.
      Parameters:
      executorId - The ID of the user responsible for executing the action
      typeId - The type ID of the punishment log
      inetAddress - The IP address associated with the punishment log
      reasonId - The reason ID for the punishment
      Returns:
      The unique identifier (UUID) of the newly created punishment log
    • addLogUser

      UUID addLogUser(int executorId, int typeId, int userId, InetAddress inetAddress, int reasonId)
      Adds a new log entry for a user to the punishment log.
      Parameters:
      executorId - The ID of the user performing the action
      typeId - The ID representing the type of log entry
      userId - The ID of the target user associated with the log
      inetAddress - The IP address of the target user
      reasonId - The ID representing the reason for the log entry
      Returns:
      A UUID representing the unique identifier of the newly added log entry
    • deleteUserLogs

      void deleteUserLogs(int userId)
      Deletes all logs associated with the specified user.
      Parameters:
      userId - The unique identifier of the user whose logs are to be deleted
    • getLogs

      List<UUID> getLogs(int userId, int typeId)
      Retrieves a list of log identifiers associated with the specified user and punishment type.
      Parameters:
      userId - The unique identifier of the user whose logs are to be retrieved
      typeId - The type of punishment associated with the logs
      Returns:
      A list of UUIDs representing the logs for the specified user and punishment type
    • getLogs

      List<UUID> getLogs(InetAddress inetAddress, int typeId)
      Retrieves a list of log identifiers associated with a specific IP address and type.
      Parameters:
      inetAddress - The IP address used to filter the logs
      typeId - The type identifier used to filter the logs
      Returns:
      A list of UUIDs representing the matching logs
    • getUserId

      int getUserId(UUID logId, int typeId)
      Retrieves the user ID associated with a specific punishment log.
      Parameters:
      logId - The unique identifier of the punishment log
      typeId - The type identifier of the punishment log
      Returns:
      The user ID associated with the specified punishment log
    • getIpAddress

      String getIpAddress(UUID logId, int typeId)
      Retrieves the IP address associated with a specific punishment log.
      Parameters:
      logId - The unique identifier of the log entry
      typeId - The type identifier of the log entry
      Returns:
      The IP address as a string, or null if no IP address is associated with the specified log
    • getReasonId

      int getReasonId(UUID logId, int typeId)
      Retrieves the reason ID associated with a specific punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log.
      typeId - The type identifier of the punishment log.
      Returns:
      The ID of the reason linked to the specified punishment log entry.
    • setReasonId

      void setReasonId(UUID logId, int typeId, int executorId, int reasonId)
      Updates the reason ID for a specific punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log entry to be updated.
      typeId - The type identifier of the punishment log entry.
      executorId - The identifier of the user making the update.
      reasonId - The new reason identifier to set for the log entry.
    • getExpiredTime

      long getExpiredTime(UUID logId, int typeId)
      Retrieves the expiration time for a specific punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log entry
      typeId - The type ID of the punishment log
      Returns:
      The expiration time of the punishment log in milliseconds since epoch
    • getExpiredDate

      String getExpiredDate(UUID logId, int typeId)
      Retrieves the expiration date of a punishment log as a string.
      Parameters:
      logId - The unique identifier of the punishment log
      typeId - The type identifier associated with the punishment log
      Returns:
      The expiration date of the specified punishment log in string format
    • setExpiredTime

      String setExpiredTime(UUID logId, int typeId, int executorId, long duration)
      Sets the expiration time for a specific punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log entry.
      typeId - The type identifier of the punishment log entry.
      executorId - The identifier of the user making this change.
      duration - The duration in milliseconds that determines the new expiration time.
      Returns:
      A string representation of the updated expiration date and time.
    • isExpired

      boolean isExpired(UUID logId, int typeId)
      Determines if the punishment log entry associated with the specified log ID and type ID is expired.
      Parameters:
      logId - The unique identifier of the punishment log entry.
      typeId - The type identifier of the punishment log entry.
      Returns:
      true if the punishment log entry is expired, otherwise false.
    • getCreatedBy

      int getCreatedBy(UUID logId, int typeId)
      Retrieves the ID of the user or entity that created the specified punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log entry
      typeId - The type identifier of the punishment log entry
      Returns:
      The ID of the creator of the punishment log entry
    • getCreatedAt

      Timestamp getCreatedAt(UUID logId, int typeId)
      Retrieves the timestamp at which a punishment log was created.
      Parameters:
      logId - The unique identifier of the punishment log
      typeId - The type identifier of the punishment log
      Returns:
      The creation timestamp of the specified punishment log
    • getModifiedBy

      int getModifiedBy(UUID logId, int typeId)
      Retrieves the ID of the user who last modified the punishment log entry.
      Parameters:
      logId - The unique identifier of the punishment log entry
      typeId - The type identifier for the log entry
      Returns:
      The ID of the user who last modified the log entry
    • getModifiedAt

      Timestamp getModifiedAt(UUID logId, int typeId)
      Retrieves the timestamp of when the specified punishment log was last modified.
      Parameters:
      logId - The unique identifier of the punishment log.
      typeId - The type identifier of the punishment log.
      Returns:
      The timestamp representing the last modification date and time of the specified log.