Record Class BanEntry.Address

java.lang.Object
java.lang.Record
fr.fidorial.moderation.BanEntry.Address
Record Components:
address - the banned address
name - the last known name of the player it was issued against, or null
reason - why the address 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.Address(InetAddress address, @Nullable String name, @Nullable Component reason, @Nullable UUID source, Instant created, @Nullable Instant expires) extends Record implements BanEntry
A ban on a client address.
Since:
0.1.0
  • Constructor Details

  • Method Details

    • permanent

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

      @Contract(pure=true) public static BanEntry.Address lasting(InetAddress address, @Nullable String name, @Nullable Component reason, @Nullable UUID source, Duration duration)
      Creates a ban on an address lasting the given amount of time, counted from now.
      Parameters:
      address - the address to ban
      name - the name to record for display, or null
      reason - why the address 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.Address until(InetAddress address, @Nullable String name, @Nullable Component reason, @Nullable UUID source, @Nullable Instant expires)
      Creates a ban on an address lifting at the given instant.
      Parameters:
      address - the address to ban
      name - the name to record for display, or null
      reason - why the address 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 address is what is banned, so it is what messages show. The recorded name is only a note about who the ban was issued against, and several players can sit behind one address.

      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.
    • address

      public InetAddress address()
      Returns the value of the address record component.
      Returns:
      the value of the address 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