Interface BanEntry

All Known Implementing Classes:
BanEntry.Address, BanEntry.Profile

public sealed interface BanEntry permits BanEntry.Profile, BanEntry.Address
Represents a ban.
Since:
0.1.0
  • Field Details

  • Method Details

    • name

      @Contract(pure=true) @Nullable String name()
      Gets the name recorded for display, which is the last known name of the player the ban was issued against.
      Returns:
      the name, or null when none was recorded
      Since:
      0.1.0
    • reason

      @Contract(pure=true) @Nullable Component reason()
      Gets why the target is banned.
      Returns:
      the reason, or null when none was given
      Since:
      0.1.0
    • source

      @Contract(pure=true) @Nullable UUID source()
      Gets who issued the ban.

      This is an identity rather than a name, so an issuer who later changes name is still the same issuer. A ban the server itself issued has no identity to record.

      Returns:
      the identity of the issuer, or null when the server issued the ban
      Since:
      0.1.0
    • created

      @Contract(pure=true) Instant created()
      Gets when the ban was issued.
      Returns:
      the creation timestamp
      Since:
      0.1.0
    • expires

      @Contract(pure=true) @Nullable Instant expires()
      Gets when the ban lifts.
      Returns:
      the expiry timestamp, or null for a permanent ban
      Since:
      0.1.0
    • label

      @Contract(pure=true) String label()
      Gets the label for what the ban applies to.
      Returns:
      the text identifying the target in messages
      Since:
      0.1.0
    • permanent

      @Contract(pure=true) default boolean permanent()
      Checks whether this ban never lifts on its own.
      Returns:
      true when the ban has no expiry
      Since:
      0.1.0
    • expired

      @Contract(pure=true) default boolean expired()
      Checks whether the expiry has already passed.

      An expired entry is not an active ban. A BanManager is expected to stop reporting it, and may discard it.

      Returns:
      true when the ban has run out
      Since:
      0.1.0
    • remaining

      @Contract(pure=true) default Optional<Duration> remaining()
      Gets how long is left before the ban lifts.
      Returns:
      the remaining time, or empty for a permanent ban; Duration.ZERO once the expiry has passed
      Since:
      0.1.0
    • describeReason

      @Contract(pure=true) default Optional<Component> describeReason()
      Gets why the target is banned.
      Returns:
      the reason, or empty when none was given
      Since:
      0.1.0
    • createdLabel

      @Contract(pure=true) default String createdLabel()
      Gets when the ban was issued, as a readable date.
      Returns:
      the creation date
      Since:
      0.1.0
    • expiresLabel

      @Contract(pure=true) default String expiresLabel()
      Gets when the ban lifts, as a readable date.
      Returns:
      the expiry date, or an empty string for a permanent ban
      Since:
      0.1.0