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 aLifestealerUserRules
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull Duration
banTime()
Returns the value of thebanTime
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of themaxHearts
record component.int
Returns the value of theminHearts
record component.int
Returns the value of thereturnHearts
record component.sum
(@NotNull LifestealerUserRules modifierRules) final String
toString()
Returns a string representation of this record class.static LifestealerUserRules
zeroed()
-
Constructor Details
-
LifestealerUserRules
public LifestealerUserRules(int maxHearts, int minHearts, @NotNull @NotNull Duration banTime, int returnHearts) Creates an instance of aLifestealerUserRules
record class.- Parameters:
maxHearts
- the value for themaxHearts
record componentminHearts
- the value for theminHearts
record componentbanTime
- the value for thebanTime
record componentreturnHearts
- the value for thereturnHearts
record 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 themaxHearts
record component.- Returns:
- the value of the
maxHearts
record component
-
minHearts
public int minHearts()Returns the value of theminHearts
record component.- Returns:
- the value of the
minHearts
record component
-
banTime
Returns the value of thebanTime
record component.- Returns:
- the value of the
banTime
record component
-
returnHearts
public int returnHearts()Returns the value of thereturnHearts
record component.- Returns:
- the value of the
returnHearts
record component
-