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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLifestealerUserRules(int maxHearts, int minHearts, @NotNull Duration banTime, int returnHearts) Creates an instance of aLifestealerUserRulesrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull DurationbanTime()Returns the value of thebanTimerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxHeartsrecord component.intReturns the value of theminHeartsrecord component.intReturns the value of thereturnHeartsrecord component.sum(@NotNull LifestealerUserRules modifierRules) final StringtoString()Returns a string representation of this record class.static LifestealerUserRuleszeroed()
-
Constructor Details
-
LifestealerUserRules
public LifestealerUserRules(int maxHearts, int minHearts, @NotNull @NotNull Duration banTime, int returnHearts) Creates an instance of aLifestealerUserRulesrecord class.- Parameters:
maxHearts- the value for themaxHeartsrecord componentminHearts- the value for theminHeartsrecord componentbanTime- the value for thebanTimerecord componentreturnHearts- the value for thereturnHeartsrecord component
-
-
Method Details
-
zeroed
-
with
public LifestealerUserRules with(Function<LifestealerUserRules.Builder, LifestealerUserRules.Builder> function) -
withSum
public LifestealerUserRules withSum(Function<LifestealerUserRules.Builder, LifestealerUserRules.Builder> function) -
sum
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
maxHearts
public int maxHearts()Returns the value of themaxHeartsrecord component.- Returns:
- the value of the
maxHeartsrecord component
-
minHearts
public int minHearts()Returns the value of theminHeartsrecord component.- Returns:
- the value of the
minHeartsrecord component
-
banTime
Returns the value of thebanTimerecord component.- Returns:
- the value of the
banTimerecord component
-
returnHearts
public int returnHearts()Returns the value of thereturnHeartsrecord component.- Returns:
- the value of the
returnHeartsrecord component
-