Record Class Moderation
java.lang.Object
java.lang.Record
net.flectone.pulse.model.value.Moderation
- Record Components:
id- the database idplayer- the punished player iddate- when the punishment was issued, in millisecondstime- when it expires, in milliseconds, orPERMANENT_TIMEreason- the stated reason, may be nullmoderator- the issuing player idtype- what kind of punishment this isvalid- whether it has not been revokedserver- the server it was issued on
public record Moderation(int id, int player, long date, long time, String reason, int moderator, Moderation.Type type, boolean valid, String server)
extends Record
A punishment issued by FlectonePulse, such as a ban, mute, warn, kick or whitelist entry.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of punishment, including the actions that revoke one. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe expiry value marking a punishment that never runs out. -
Constructor Summary
ConstructorsConstructorDescriptionModeration(int id, int player, long date, long time, String reason, int moderator, Moderation.Type type, boolean valid, String server) Creates an instance of aModerationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongdate()Returns the value of thedaterecord component.final booleanIndicates whether some other object is "equal to" this one.booleanequals(Moderation moderation) Compares by database id only, ignoring fields that change as the punishment ages.longThe full length the punishment was issued for, rounded to whole seconds.longMilliseconds left before this punishment expires.final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.booleanisActive()Whether this punishment still applies, meaning it is neither revoked nor expired.booleanWhether the expiry time has passed.booleanWhether this punishment never expires.intReturns the value of themoderatorrecord component.intplayer()Returns the value of theplayerrecord component.reason()Returns the value of thereasonrecord component.server()Returns the value of theserverrecord component.longtime()Returns the value of thetimerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.booleanvalid()Returns the value of thevalidrecord component.withDate(long date) withId(int id) withModerator(int moderator) withPlayer(int player) withReason(String reason) withServer(String server) withTime(long time) withType(Moderation.Type type) withValid(boolean valid)
-
Field Details
-
PERMANENT_TIME
public static final int PERMANENT_TIMEThe expiry value marking a punishment that never runs out.- See Also:
-
-
Constructor Details
-
Moderation
public Moderation(int id, int player, long date, long time, String reason, int moderator, Moderation.Type type, boolean valid, String server) Creates an instance of aModerationrecord class.- Parameters:
id- the value for theidrecord componentplayer- the value for theplayerrecord componentdate- the value for thedaterecord componenttime- the value for thetimerecord componentreason- the value for thereasonrecord componentmoderator- the value for themoderatorrecord componenttype- the value for thetyperecord componentvalid- the value for thevalidrecord componentserver- the value for theserverrecord component
-
-
Method Details
-
isActive
public boolean isActive()Whether this punishment still applies, meaning it is neither revoked nor expired.- Returns:
- true while the punishment is in force
-
isPermanent
public boolean isPermanent()Whether this punishment never expires.- Returns:
- true if permanent
-
isExpired
public boolean isExpired()Whether the expiry time has passed. Permanent punishments never expire.- Returns:
- true if the punishment has run out
-
getRemainingTime
public long getRemainingTime()Milliseconds left before this punishment expires.- Returns:
- the remaining time, or
PERMANENT_TIMEif permanent
-
getOriginalTime
public long getOriginalTime()The full length the punishment was issued for, rounded to whole seconds.- Returns:
- the original duration in milliseconds
-
equals
Compares by database id only, ignoring fields that change as the punishment ages.- Parameters:
moderation- the punishment to compare against- Returns:
- true if both refer to the same record
-
withId
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withPlayer
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withDate
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withTime
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withReason
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withModerator
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withType
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withValid
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withServer
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
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
-
player
-
date
-
time
-
reason
-
moderator
-
type
-
valid
-
server
-