Record Class BanEntry.Profile

java.lang.Object
java.lang.Record
fr.fidorial.moderation.BanEntry.Profile
Record Components:
uuid - the banned identity
name - the last known name of the player, or null
reason - why the player is banned, or null
source - the identity of who issued the ban, or null for the server
created - when the ban was issued
expires - when the ban lifts, or null for a permanent ban
All Implemented Interfaces:
BanEntry
Enclosing interface:
BanEntry

public static record BanEntry.Profile(UUID uuid, @Nullable String name, @Nullable Component reason, @Nullable UUID source, Instant created, @Nullable Instant expires) extends Record implements BanEntry
A ban on a player identity.
Since:
0.1.0
  • Constructor Details

  • Method Details

    • permanent

      @Contract(pure=true) public static BanEntry.Profile permanent(UUID uuid, @Nullable String name, @Nullable Component reason, @Nullable UUID source)
      Creates a ban on an identity that never lifts.
      Parameters:
      uuid - the identity to ban
      name - the name to record for display, or null
      reason - why the player is banned, or null
      source - the identity of who is issuing the ban, or null for the server
      Returns:
      the ban
      Since:
      0.1.0
    • lasting

      @Contract(pure=true) public static BanEntry.Profile lasting(UUID uuid, @Nullable String name, @Nullable Component reason, @Nullable UUID source, Duration duration)
      Creates a ban on an identity lasting the given amount of time, counted from now.
      Parameters:
      uuid - the identity to ban
      name - the name to record for display, or null
      reason - why the player is banned, or null
      source - who is issuing the ban
      duration - how long the ban lasts
      Returns:
      the ban
      Since:
      0.1.0
    • until

      @Contract(pure=true) public static BanEntry.Profile until(UUID uuid, @Nullable String name, @Nullable Component reason, @Nullable UUID source, @Nullable Instant expires)
      Creates a ban on an identity lifting at the given instant.
      Parameters:
      uuid - the identity to ban
      name - the name to record for display, or null
      reason - why the player is banned, or null
      source - who is issuing the ban
      expires - when the ban lifts, or null for a permanent ban
      Returns:
      the ban
      Since:
      0.1.0
    • label

      @Contract(pure=true) public String label()
      Gets the label for what the ban applies to.

      The recorded name is preferred, since a raw identity means nothing to a moderator.

      Specified by:
      label in interface BanEntry
      Returns:
      the text identifying the target in messages
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • name

      public @Nullable String name()
      Returns the value of the name record component.
      Specified by:
      name in interface BanEntry
      Returns:
      the value of the name record component
    • reason

      public @Nullable Component reason()
      Returns the value of the reason record component.
      Specified by:
      reason in interface BanEntry
      Returns:
      the value of the reason record component
    • source

      public @Nullable UUID source()
      Returns the value of the source record component.
      Specified by:
      source in interface BanEntry
      Returns:
      the value of the source record component
    • created

      public Instant created()
      Returns the value of the created record component.
      Specified by:
      created in interface BanEntry
      Returns:
      the value of the created record component
    • expires

      public @Nullable Instant expires()
      Returns the value of the expires record component.
      Specified by:
      expires in interface BanEntry
      Returns:
      the value of the expires record component