Class PunishmentLogProvider

java.lang.Object
de.murmelmeister.murmelapi.punishment.log.PunishmentLogProvider
All Implemented Interfaces:
PunishmentLog

public final class PunishmentLogProvider extends Object implements PunishmentLog
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    static void
    setup(Database database)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • setup

      public static void setup(Database database)
    • existsLog

      public boolean existsLog(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Checks if a log entry exists based on the specified log ID and type ID.
      Specified by:
      existsLog in interface PunishmentLog
      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

      public UUID addLogIp(int executorId, int typeId, InetAddress inetAddress, int reasonId)
      Description copied from interface: PunishmentLog
      Adds a punishment log associated with an IP address to the system.
      Specified by:
      addLogIp in interface PunishmentLog
      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

      public UUID addLogUser(int executorId, int typeId, int userId, InetAddress inetAddress, int reasonId)
      Description copied from interface: PunishmentLog
      Adds a new log entry for a user to the punishment log.
      Specified by:
      addLogUser in interface PunishmentLog
      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

      public void deleteUserLogs(int userId)
      Description copied from interface: PunishmentLog
      Deletes all logs associated with the specified user.
      Specified by:
      deleteUserLogs in interface PunishmentLog
      Parameters:
      userId - The unique identifier of the user whose logs are to be deleted
    • getLogs

      public List<UUID> getLogs(int userId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves a list of log identifiers associated with the specified user and punishment type.
      Specified by:
      getLogs in interface PunishmentLog
      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

      public List<UUID> getLogs(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves a list of log identifiers associated with a specific IP address and type.
      Specified by:
      getLogs in interface PunishmentLog
      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

      public int getUserId(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the user ID associated with a specific punishment log.
      Specified by:
      getUserId in interface PunishmentLog
      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

      public String getIpAddress(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the IP address associated with a specific punishment log.
      Specified by:
      getIpAddress in interface PunishmentLog
      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

      public int getReasonId(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the reason ID associated with a specific punishment log entry.
      Specified by:
      getReasonId in interface PunishmentLog
      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

      public void setReasonId(UUID logId, int typeId, int executorId, int reasonId)
      Description copied from interface: PunishmentLog
      Updates the reason ID for a specific punishment log entry.
      Specified by:
      setReasonId in interface PunishmentLog
      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

      public long getExpiredTime(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the expiration time for a specific punishment log entry.
      Specified by:
      getExpiredTime in interface PunishmentLog
      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

      public String getExpiredDate(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the expiration date of a punishment log as a string.
      Specified by:
      getExpiredDate in interface PunishmentLog
      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

      public String setExpiredTime(UUID logId, int typeId, int executorId, long duration)
      Description copied from interface: PunishmentLog
      Sets the expiration time for a specific punishment log entry.
      Specified by:
      setExpiredTime in interface PunishmentLog
      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

      public boolean isExpired(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Determines if the punishment log entry associated with the specified log ID and type ID is expired.
      Specified by:
      isExpired in interface PunishmentLog
      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

      public int getCreatedBy(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the ID of the user or entity that created the specified punishment log entry.
      Specified by:
      getCreatedBy in interface PunishmentLog
      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

      public Timestamp getCreatedAt(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the timestamp at which a punishment log was created.
      Specified by:
      getCreatedAt in interface PunishmentLog
      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

      public int getModifiedBy(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the ID of the user who last modified the punishment log entry.
      Specified by:
      getModifiedBy in interface PunishmentLog
      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

      public Timestamp getModifiedAt(UUID logId, int typeId)
      Description copied from interface: PunishmentLog
      Retrieves the timestamp of when the specified punishment log was last modified.
      Specified by:
      getModifiedAt in interface PunishmentLog
      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.