Record Class LifestealerUser.Ban

java.lang.Object
java.lang.Record
dev.chicoferreira.lifestealer.user.LifestealerUser.Ban
Record Components:
start - the start of the ban
duration - the duration of the ban
Enclosing class:
LifestealerUser

public static record LifestealerUser.Ban(@NotNull Instant start, @NotNull Duration duration) extends Record
A record containing information about a ban.
  • Constructor Details

    • Ban

      public Ban(@NotNull @NotNull Instant start, @NotNull @NotNull Duration duration)
      Creates an instance of a Ban record class.
      Parameters:
      start - the value for the start record component
      duration - the value for the duration record component
  • Method Details

    • end

      public Instant end()
      Gets the end Instant of the ban.
      Returns:
      the end of the ban
    • endZoned

      public ZonedDateTime endZoned(ZoneId zoneId)
      Gets the end ZonedDateTime of the ban in the given zone id.
      Parameters:
      zoneId - the zone id to convert the end to
      Returns:
      the end ZonedDateTime of the ban in the given zone id
    • endZoned

      public ZonedDateTime endZoned()
      Gets the end ZonedDateTime of the ban in the system default zone id.
      Returns:
      the end ZonedDateTime of the ban in the system default zone id
    • isBanActive

      public boolean isBanActive()
      Checks if the ban is still active (the remaining time is greater than 0).
      Returns:
      true if the ban is still active, otherwise false
    • remaining

      public Duration remaining()
      Gets the remaining Duration of the ban.
      Returns:
      the remaining time of the ban
    • 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.
    • start

      @NotNull public @NotNull Instant start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • duration

      @NotNull public @NotNull Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component