Package dev.itsharshxd.zentrix.api.perk
Record Class PerkTier
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.perk.PerkTier
- Record Components:
id- the tier's key inperks.ymldisplayName- the name shown to players, with its color codespermission- the node that puts a player in the tierpriority- higher wins when a player holds several tiers' permissionsnumbers- thePerk.Type.NUMBERbuilt-in perks the tier sets or inheritstoggles- thePerk.Type.TOGGLEbuilt-in perks the tier sets or inheritsparent- the ID of the tier it inherits from, or null (since 1.16.0)icon- the item it wears in menus, or null for the default (since 1.16.0)description- lines describing it in menus, with color codes (since 1.16.0)addonNumbers- the number addon perks it sets or inherits, by key (since 1.16.0)addonToggles- the toggle addon perks it sets or inherits, by key (since 1.16.0)
public record PerkTier(@NotNull String id, @NotNull String displayName, @NotNull String permission, int priority, @NotNull Map<Perk,Integer> numbers, @NotNull Map<Perk,Boolean> toggles, @Nullable String parent, @Nullable org.bukkit.Material icon, @NotNull List<String> description, @NotNull Map<String,Integer> addonNumbers, @NotNull Map<String,Boolean> addonToggles)
extends Record
One named tier of
perks.yml, such as vip. A snapshot.
A player belongs to the enabled tier with the highest priority whose permission they hold. A tier may inherit from a parent tier: each value comes from the tier itself, then up its parent chain, and only then from the server-wide default. The values here are the effective ones, inherited values included; a perk none of them sets follows the server-wide default.
A number value of PerkDefinition.UNLIMITED (-1) means unlimited, for perks
that support it.
- Since:
- 1.9.0
-
Constructor Summary
ConstructorsConstructorDescriptionPerkTier(@NotNull String id, @NotNull String displayName, @NotNull String permission, int priority, @NotNull Map<Perk, Integer> numbers, @NotNull Map<Perk, Boolean> toggles) A tier without a parent, icon, description or addon perks.PerkTier(@NotNull String id, @NotNull String displayName, @NotNull String permission, int priority, @NotNull Map<Perk, Integer> numbers, @NotNull Map<Perk, Boolean> toggles, @Nullable String parent, @Nullable org.bukkit.Material icon, @NotNull List<String> description, @NotNull Map<String, Integer> addonNumbers, @NotNull Map<String, Boolean> addonToggles) Creates an instance of aPerkTierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaddonNumbersrecord component.Returns the value of theaddonTogglesrecord component.Returns the value of thedescriptionrecord component.@NotNull StringReturns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.@NotNull OptionalIntThe number the tier sets for aPerk.Type.NUMBERperk, if it sets one;PerkDefinition.UNLIMITEDwhen unlimited.@NotNull OptionalIntThe number the tier sets for a number perk, built-in or addon, by its key.The parent tier's ID, when the tier inherits from one.Whether the tier allows aPerk.Type.TOGGLEperk, if it sets it.Whether the tier allows a toggle perk, built-in or addon, by its key, if it sets it.final inthashCode()Returns a hash code value for this object.@Nullable org.bukkit.Materialicon()Returns the value of theiconrecord component.@NotNull Stringid()Returns the value of theidrecord component.numbers()Returns the value of thenumbersrecord component.@Nullable Stringparent()Returns the value of theparentrecord component.@NotNull StringReturns the value of thepermissionrecord component.intpriority()Returns the value of thepriorityrecord component.booleanWhether the tier sets or inherits a perk rather than leaving it to the server-wide default.booleanWhether the tier sets or inherits a perk, built-in or addon, by its key.toggles()Returns the value of thetogglesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PerkTier
public PerkTier(@NotNull @NotNull String id, @NotNull @NotNull String displayName, @NotNull @NotNull String permission, int priority, @NotNull @NotNull Map<Perk, Integer> numbers, @NotNull @NotNull Map<Perk, Boolean> toggles, @Nullable @Nullable String parent, @Nullable @Nullable org.bukkit.Material icon, @NotNull @NotNull List<String> description, @NotNull @NotNull Map<String, Integer> addonNumbers, @NotNull @NotNull Map<String, Boolean> addonToggles) Creates an instance of aPerkTierrecord class.- Parameters:
id- the value for theidrecord componentdisplayName- the value for thedisplayNamerecord componentpermission- the value for thepermissionrecord componentpriority- the value for thepriorityrecord componentnumbers- the value for thenumbersrecord componenttoggles- the value for thetogglesrecord componentparent- the value for theparentrecord componenticon- the value for theiconrecord componentdescription- the value for thedescriptionrecord componentaddonNumbers- the value for theaddonNumbersrecord componentaddonToggles- the value for theaddonTogglesrecord component
-
PerkTier
public PerkTier(@NotNull @NotNull String id, @NotNull @NotNull String displayName, @NotNull @NotNull String permission, int priority, @NotNull @NotNull Map<Perk, Integer> numbers, @NotNull @NotNull Map<Perk, Boolean> toggles) A tier without a parent, icon, description or addon perks.
-
-
Method Details
-
sets
Whether the tier sets or inherits a perk rather than leaving it to the server-wide default. -
sets
Whether the tier sets or inherits a perk, built-in or addon, by its key.- Since:
- 1.16.0
-
getNumber
The number the tier sets for aPerk.Type.NUMBERperk, if it sets one;PerkDefinition.UNLIMITEDwhen unlimited. -
getNumber
The number the tier sets for a number perk, built-in or addon, by its key.- Since:
- 1.16.0
-
getToggle
Whether the tier allows aPerk.Type.TOGGLEperk, if it sets it. -
getToggle
Whether the tier allows a toggle perk, built-in or addon, by its key, if it sets it.- Since:
- 1.16.0
-
getParent
The parent tier's ID, when the tier inherits from one.- Since:
- 1.16.0
-
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 '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
permission
Returns the value of thepermissionrecord component.- Returns:
- the value of the
permissionrecord component
-
priority
public int priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
numbers
Returns the value of thenumbersrecord component.- Returns:
- the value of the
numbersrecord component
-
toggles
Returns the value of thetogglesrecord component.- Returns:
- the value of the
togglesrecord component
-
parent
Returns the value of theparentrecord component.- Returns:
- the value of the
parentrecord component
-
icon
@Nullable public @Nullable org.bukkit.Material icon()Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
addonNumbers
Returns the value of theaddonNumbersrecord component.- Returns:
- the value of the
addonNumbersrecord component
-
addonToggles
Returns the value of theaddonTogglesrecord component.- Returns:
- the value of the
addonTogglesrecord component
-