Record Class LifestealerUserRules

java.lang.Object
java.lang.Record
dev.chicoferreira.lifestealer.user.rules.LifestealerUserRules
Record Components:
maxHearts - The maximum amount of hearts a player can have. The player cannot consume more than this amount.
minHearts - The minimum amount of hearts a player can have. If a player has less than this amount, they will be banned temporarily.
banTime - The duration that a player will be banned if they have less than the minimum amount of hearts.
returnHearts - The amount of hearts a player will have when they return from a ban.

@ConfigSerializable public record LifestealerUserRules(int maxHearts, int minHearts, @NotNull Duration banTime, int returnHearts) extends Record
Represents the rules the user has. This is calculated through the LifestealerUserRulesController and the rules modifiers the suer has. The rules are used to determine the maximum and minimum amount of hearts a player can have, the ban time if they have less than the minimum amount of hearts, and the amount of hearts they will have when they return from a ban.

This is also used as a modifier for the user rules. A rules modifier is just a rule that will be added to the calculated rules based on the permissions. The values of it can be negative, meaning that the modifier decreases the value of the rule. These modifiers are individual for each user and can be retrieved through the LifestealerUser.getRulesModifier() method.

  • Constructor Details

    • LifestealerUserRules

      public LifestealerUserRules(int maxHearts, int minHearts, @NotNull @NotNull Duration banTime, int returnHearts)
      Creates an instance of a LifestealerUserRules record class.
      Parameters:
      maxHearts - the value for the maxHearts record component
      minHearts - the value for the minHearts record component
      banTime - the value for the banTime record component
      returnHearts - the value for the returnHearts record component
  • Method Details

    • zeroed

      public static LifestealerUserRules zeroed()
    • with

    • withSum

    • sum

      public LifestealerUserRules sum(@NotNull @NotNull LifestealerUserRules modifierRules)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • maxHearts

      public int maxHearts()
      Returns the value of the maxHearts record component.
      Returns:
      the value of the maxHearts record component
    • minHearts

      public int minHearts()
      Returns the value of the minHearts record component.
      Returns:
      the value of the minHearts record component
    • banTime

      @NotNull public @NotNull Duration banTime()
      Returns the value of the banTime record component.
      Returns:
      the value of the banTime record component
    • returnHearts

      public int returnHearts()
      Returns the value of the returnHearts record component.
      Returns:
      the value of the returnHearts record component