Class PunishmentUserProvider

java.lang.Object
de.murmelmeister.murmelapi.punishment.PunishmentUserProvider
All Implemented Interfaces:
PunishmentUser

public final class PunishmentUserProvider extends Object implements PunishmentUser
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    static void
    setup(Database database)
     
    void
    unpunished(int userId, int typeId)
    Removes the punishment for the specified user and type.

    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(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Checks if a record or punishment exists for a specific type and user.
      Specified by:
      exists in interface PunishmentUser
      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

      public void punish(int userId, int typeId, int executorId, InetAddress inetAddress, int reasonId)
      Description copied from interface: PunishmentUser
      Applies a punishment to a user.
      Specified by:
      punish in interface PunishmentUser
      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

      public void unpunished(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Removes the punishment for the specified user and type.
      Specified by:
      unpunished in interface PunishmentUser
      Parameters:
      userId - The identifier of the user
      typeId - The identifier of the punishment type
    • getUsers

      public List<Integer> getUsers(int typeId)
      Description copied from interface: PunishmentUser
      Retrieves a list of user IDs associated with the specified punishment type.
      Specified by:
      getUsers in interface PunishmentUser
      Parameters:
      typeId - The ID of the punishment type
      Returns:
      A list of user IDs associated with the specified punishment type
    • getLogId

      public UUID getLogId(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the log identifier related to a specific type and user.
      Specified by:
      getLogId in interface PunishmentUser
      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

      public int getReasonId(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the reason ID associated with the specified type and user ID.
      Specified by:
      getReasonId in interface PunishmentUser
      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

      public void setReasonId(int userId, int typeId, int executorId, int reasonId)
      Description copied from interface: PunishmentUser
      Updates the reason associated with the punishment of a user.
      Specified by:
      setReasonId in interface PunishmentUser
      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

      public String getReason(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the reason associated with a specified type and user by their respective IDs.
      Specified by:
      getReason in interface PunishmentUser
      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

      public long getDuration(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the duration of a punishment for a specified type and user.
      Specified by:
      getDuration in interface PunishmentUser
      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

      public long getExpiredTime(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the expiration time of a punishment for a specific user and type.
      Specified by:
      getExpiredTime in interface PunishmentUser
      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

      public String getExpiredDate(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the expiration date of a punishment for a specific user and type.
      Specified by:
      getExpiredDate in interface PunishmentUser
      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

      public void setExpiredTime(int userId, int typeId, int executorId, long time)
      Description copied from interface: PunishmentUser
      Sets the expiration time for a punishment record.
      Specified by:
      setExpiredTime in interface PunishmentUser
      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

      public boolean isPunished(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Determines whether the specified user is currently punished for the given type.
      Specified by:
      isPunished in interface PunishmentUser
      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

      public int getCreatedBy(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the identifier of the user who created a punishment record.
      Specified by:
      getCreatedBy in interface PunishmentUser
      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

      public Timestamp getCreatedAt(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the timestamp representing when the entity associated with the specified type and user was created.
      Specified by:
      getCreatedAt in interface PunishmentUser
      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

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

      public Timestamp getModifiedAt(int userId, int typeId)
      Description copied from interface: PunishmentUser
      Retrieves the timestamp of the last modification made to the punishment details of a user specified by their type ID and user ID.
      Specified by:
      getModifiedAt in interface PunishmentUser
      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