Class PunishmentIPProvider

java.lang.Object
de.murmelmeister.murmelapi.punishment.PunishmentIPProvider
All Implemented Interfaces:
PunishmentIP

public final class PunishmentIPProvider extends Object implements PunishmentIP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    exists(InetAddress inetAddress, int typeId)
    Checks if a punishment record exists for the given type ID and IP address.
    getCreatedAt(InetAddress inetAddress, int typeId)
    Retrieves the timestamp indicating when the specified punishment record was created.
    int
    getCreatedBy(InetAddress inetAddress, int typeId)
    Retrieves the identifier of the user who created a punishment for the specified type and IP address.
    long
    getDuration(InetAddress inetAddress, int typeId)
    Retrieves the duration associated with a specific type and IP address.
    getExpiredDate(InetAddress inetAddress, int typeId)
    Retrieves the expiration date as a string for a specific punishment type and IP address.
    long
    getExpiredTime(InetAddress inetAddress, int typeId)
    Retrieves the expiration time of the punishment for the specified type and IP address.
    getIps(int typeId)
    Retrieves a list of IP addresses associated with the specified type.
    getLogId(InetAddress inetAddress, int typeId)
    Retrieves the log identifier associated with the specified type ID and IP address.
    getModifiedAt(InetAddress inetAddress, int typeId)
    Retrieves the timestamp when the specified punishment was last modified.
    int
    getModifiedBy(InetAddress inetAddress, int typeId)
    Retrieves the ID of the entity or executor that last modified the punishment record based on the provided punishment type ID and IP address.
    getReason(InetAddress inetAddress, int typeId)
    Retrieves the reason associated with a specific punishment type and IP address.
    int
    getReasonId(InetAddress inetAddress, int typeId)
    Retrieves the reason identifier associated with a specific type and IP address.
    boolean
    isPunished(InetAddress inetAddress, int typeId)
    Checks if a specific IP address is currently punished for a given type.
    void
    punish(InetAddress inetAddress, int typeId, int executorId, int reasonId)
    Applies a punishment for a given IP address with specific type and reason.
    void
    setExpiredTime(InetAddress inetAddress, int typeId, int executorId, long time)
    Sets the expiration time for a specific punishment on an IP address.
    void
    setReasonId(InetAddress inetAddress, int typeId, int executorId, int reasonId)
    Updates the reason ID for an existing punishment associated with the specified type, IP address, and executor.
    static void
    setup(Database database)
     
    void
    unpunished(InetAddress inetAddress, int typeId)
    Removes the punishment associated with the given type and IP address.

    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)
    • exists

      public boolean exists(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Checks if a punishment record exists for the given type ID and IP address.
      Specified by:
      exists in interface PunishmentIP
      Parameters:
      inetAddress - The IP address to check for existence of a punishment
      typeId - The ID representing the type of punishment
      Returns:
      true if a punishment record exists for the specified type ID and IP address, false otherwise
    • punish

      public void punish(InetAddress inetAddress, int typeId, int executorId, int reasonId)
      Description copied from interface: PunishmentIP
      Applies a punishment for a given IP address with specific type and reason.
      Specified by:
      punish in interface PunishmentIP
      Parameters:
      inetAddress - The IP address to which the punishment will be applied
      typeId - The type identifier of the punishment
      executorId - The identifier of the executor applying the punishment
      reasonId - The identifier of the reason for the punishment
    • unpunished

      public void unpunished(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Removes the punishment associated with the given type and IP address.
      Specified by:
      unpunished in interface PunishmentIP
      Parameters:
      inetAddress - The IP address for which the punishment is removed
      typeId - The identifier of the punishment type to remove
    • getIps

      public List<String> getIps(int typeId)
      Description copied from interface: PunishmentIP
      Retrieves a list of IP addresses associated with the specified type.
      Specified by:
      getIps in interface PunishmentIP
      Parameters:
      typeId - The identifier for the type of punishment or record for which the IPs are to be retrieved
      Returns:
      A list of IP addresses corresponding to the specified type
    • getLogId

      public UUID getLogId(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the log identifier associated with the specified type ID and IP address.
      Specified by:
      getLogId in interface PunishmentIP
      Parameters:
      inetAddress - The IP address for which the log ID is being queried
      typeId - An integer representing the type identifier for the punishment or operation
      Returns:
      A UUID representing the log identifier, or null if no log is associated with the given parameters
    • getReasonId

      public int getReasonId(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the reason identifier associated with a specific type and IP address.
      Specified by:
      getReasonId in interface PunishmentIP
      Parameters:
      inetAddress - The IP address for which the reason identifier is being requested.
      typeId - The identifier representing the punishment type.
      Returns:
      The reason identifier associated with the specified type and IP address.
    • setReasonId

      public void setReasonId(InetAddress inetAddress, int typeId, int executorId, int reasonId)
      Description copied from interface: PunishmentIP
      Updates the reason ID for an existing punishment associated with the specified type, IP address, and executor.
      Specified by:
      setReasonId in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The type identifier for the punishment
      executorId - The identifier of the executor making the change
      reasonId - The new reason identifier to be set
    • getReason

      public String getReason(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the reason associated with a specific punishment type and IP address.
      Specified by:
      getReason in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The identifier for the punishment type
      Returns:
      The reason for the punishment as a String
    • getDuration

      public long getDuration(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the duration associated with a specific type and IP address.
      Specified by:
      getDuration in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the entity
      typeId - The identifier of the type for which the duration is being retrieved
      Returns:
      The duration in milliseconds
    • getExpiredTime

      public long getExpiredTime(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the expiration time of the punishment for the specified type and IP address.
      Specified by:
      getExpiredTime in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The identification number of the punishment type
      Returns:
      The expiration time of the punishment in milliseconds since epoch
    • getExpiredDate

      public String getExpiredDate(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the expiration date as a string for a specific punishment type and IP address.
      Specified by:
      getExpiredDate in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The identifier of the punishment type
      Returns:
      The expiration date as a string, or null if no expiration date is set
    • setExpiredTime

      public void setExpiredTime(InetAddress inetAddress, int typeId, int executorId, long time)
      Description copied from interface: PunishmentIP
      Sets the expiration time for a specific punishment on an IP address.
      Specified by:
      setExpiredTime in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment.
      typeId - The type identifier of the punishment.
      executorId - The ID of the executor making this change.
      time - The new expiration time for the punishment in milliseconds since epoch.
    • isPunished

      public boolean isPunished(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Checks if a specific IP address is currently punished for a given type.
      Specified by:
      isPunished in interface PunishmentIP
      Parameters:
      inetAddress - The IP address to check
      typeId - The unique identifier of the type of punishment
      Returns:
      true if the IP address is punished for the specified type, false otherwise
    • getCreatedBy

      public int getCreatedBy(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the identifier of the user who created a punishment for the specified type and IP address.
      Specified by:
      getCreatedBy in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The type identifier associated with the punishment
      Returns:
      The identifier of the creator of the punishment
    • getCreatedAt

      public Timestamp getCreatedAt(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the timestamp indicating when the specified punishment record was created.
      Specified by:
      getCreatedAt in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment record
      typeId - The unique identifier of the punishment type
      Returns:
      The timestamp of the creation time for the punishment record
    • getModifiedBy

      public int getModifiedBy(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the ID of the entity or executor that last modified the punishment record based on the provided punishment type ID and IP address.
      Specified by:
      getModifiedBy in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment.
      typeId - The type identifier of the punishment.
      Returns:
      The identifier of the entity or executor who last modified the punishment record.
    • getModifiedAt

      public Timestamp getModifiedAt(InetAddress inetAddress, int typeId)
      Description copied from interface: PunishmentIP
      Retrieves the timestamp when the specified punishment was last modified.
      Specified by:
      getModifiedAt in interface PunishmentIP
      Parameters:
      inetAddress - The IP address associated with the punishment
      typeId - The identifier of the punishment type
      Returns:
      The timestamp indicating the last modification time of the punishment