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
ConstructorsConstructorDescriptionPunishment(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 aPunishmentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanactive()Returns the value of theactiverecord component.final booleanIndicates whether some other object is "equal to" this one.@Nullable LongReturns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.longid()Returns the value of theidrecord component.booleanbooleanlongissuedAt()Returns the value of theissuedAtrecord component.@Nullable UUIDissuedBy()Returns the value of theissuedByrecord component.reason()Returns the value of thereasonrecord component.@Nullable LongReturns the value of therevokedAtrecord component.@Nullable UUIDReturns the value of therevokedByrecord component.@Nullable UUIDtarget()Returns the value of thetargetrecord component.@Nullable StringtargetIp()Returns the value of thetargetIprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
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 aPunishmentrecord class.- Parameters:
id- the value for theidrecord componenttarget- the value for thetargetrecord componenttargetIp- the value for thetargetIprecord componenttype- the value for thetyperecord componentreason- the value for thereasonrecord componentissuedBy- the value for theissuedByrecord componentissuedAt- the value for theissuedAtrecord componentexpiresAt- the value for theexpiresAtrecord componentactive- the value for theactiverecord componentrevokedBy- the value for therevokedByrecord componentrevokedAt- the value for therevokedAtrecord component
-
-
Method Details
-
isPermanent
public boolean isPermanent() -
isExpired
public boolean isExpired() -
revoked
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
public long id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
targetIp
Returns the value of thetargetIprecord component.- Returns:
- the value of the
targetIprecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
issuedBy
Returns the value of theissuedByrecord component.- Returns:
- the value of the
issuedByrecord component
-
issuedAt
public long issuedAt()Returns the value of theissuedAtrecord component.- Returns:
- the value of the
issuedAtrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-
active
public boolean active()Returns the value of theactiverecord component.- Returns:
- the value of the
activerecord component
-
revokedBy
Returns the value of therevokedByrecord component.- Returns:
- the value of the
revokedByrecord component
-
revokedAt
Returns the value of therevokedAtrecord component.- Returns:
- the value of the
revokedAtrecord component
-