Record Class Punishment

java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.moderation.Punishment

public record Punishment(long id, @Nullable UUID target, @Nullable String targetIp, PunishmentType type, String reason, @Nullable UUID issuedBy, long issuedAt, @Nullable Long expiresAt, boolean active, @Nullable UUID revokedBy, @Nullable Long revokedAt) extends Record
A single punishment record, active or historical. target and targetIp are independent so an IP-ban can outlive knowledge of which account triggered it, and so a name-ban's history stays queryable even for a player who never had an IP recorded.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Punishment(long id, @Nullable UUID target, @Nullable String targetIp, PunishmentType type, String reason, @Nullable UUID issuedBy, long issuedAt, @Nullable Long expiresAt, boolean active, @Nullable UUID revokedBy, @Nullable Long revokedAt)
    Creates an instance of a Punishment record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the active record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @Nullable Long
    Returns the value of the expiresAt record component.
    final int
    Returns a hash code value for this object.
    long
    id()
    Returns the value of the id record component.
    boolean
     
    boolean
     
    long
    Returns the value of the issuedAt record component.
    @Nullable UUID
    Returns the value of the issuedBy record component.
    Returns the value of the reason record component.
    revoked(@Nullable UUID by)
     
    @Nullable Long
    Returns the value of the revokedAt record component.
    @Nullable UUID
    Returns the value of the revokedBy record component.
    @Nullable UUID
    Returns the value of the target record component.
    @Nullable String
    Returns the value of the targetIp record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Punishment

      public Punishment(long id, @Nullable @Nullable UUID target, @Nullable @Nullable String targetIp, PunishmentType type, String reason, @Nullable @Nullable UUID issuedBy, long issuedAt, @Nullable @Nullable Long expiresAt, boolean active, @Nullable @Nullable UUID revokedBy, @Nullable @Nullable Long revokedAt)
      Creates an instance of a Punishment record class.
      Parameters:
      id - the value for the id record component
      target - the value for the target record component
      targetIp - the value for the targetIp record component
      type - the value for the type record component
      reason - the value for the reason record component
      issuedBy - the value for the issuedBy record component
      issuedAt - the value for the issuedAt record component
      expiresAt - the value for the expiresAt record component
      active - the value for the active record component
      revokedBy - the value for the revokedBy record component
      revokedAt - the value for the revokedAt record component
  • Method Details

    • isPermanent

      public boolean isPermanent()
    • isExpired

      public boolean isExpired()
    • revoked

      public Punishment revoked(@Nullable @Nullable UUID by)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public long id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • target

      @Nullable public @Nullable UUID target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • targetIp

      @Nullable public @Nullable String targetIp()
      Returns the value of the targetIp record component.
      Returns:
      the value of the targetIp record component
    • type

      public PunishmentType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component
    • issuedBy

      @Nullable public @Nullable UUID issuedBy()
      Returns the value of the issuedBy record component.
      Returns:
      the value of the issuedBy record component
    • issuedAt

      public long issuedAt()
      Returns the value of the issuedAt record component.
      Returns:
      the value of the issuedAt record component
    • expiresAt

      @Nullable public @Nullable Long expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • active

      public boolean active()
      Returns the value of the active record component.
      Returns:
      the value of the active record component
    • revokedBy

      @Nullable public @Nullable UUID revokedBy()
      Returns the value of the revokedBy record component.
      Returns:
      the value of the revokedBy record component
    • revokedAt

      @Nullable public @Nullable Long revokedAt()
      Returns the value of the revokedAt record component.
      Returns:
      the value of the revokedAt record component