Record Class Cosmetic
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.cosmetics.Cosmetic
- Record Components:
type- the type it belongs toid- the stable ID ownership is stored undername- the display name, in Zentrix's colour formaticon- the icon menus show it with; a copylore- the description lines, in Zentrix's colour formatrarity- the rarity label, in Zentrix's colour format, or null for nonepermission- the permission that unlocks it without owning it, or null for noneprice- what it costs in Zentrix's currency, or null when it is not for salesource- the name of the plugin that provides it,Zentrixfor built-in ones
public record Cosmetic(@NotNull CosmeticTypeKey type, @NotNull String id, @NotNull String name, @NotNull org.bukkit.inventory.ItemStack icon, @NotNull List<String> lore, @Nullable String rarity, @Nullable String permission, @Nullable Double price, @NotNull String source)
extends Record
One cosmetic as menus show it, of a built-in category or an addon's type. A snapshot: later
edits do not change it.
Zentrix's own cosmetics have no rarity or price: they are granted, or unlocked by their
permission. An addon's carry whatever its CosmeticDefinition sets.
- Since:
- 1.11.0
-
Constructor Summary
ConstructorsConstructorDescriptionCosmetic(@NotNull CosmeticTypeKey type, @NotNull String id, @NotNull String name, @NotNull org.bukkit.inventory.ItemStack icon, @NotNull List<String> lore, @Nullable String rarity, @Nullable String permission, @Nullable Double price, @NotNull String source) Creates an instance of aCosmeticrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.The permission that unlocks it, when there is one.@NotNull OptionalDoublegetPrice()What it costs; empty when it is not for sale.The rarity label, when there is one.final inthashCode()Returns a hash code value for this object.@NotNull org.bukkit.inventory.ItemStackicon()A copy of the icon.@NotNull Stringid()Returns the value of theidrecord component.booleanWhether Zentrix itself provides it.booleanWhether it can be bought with Zentrix's currency.lore()Returns the value of thelorerecord component.@NotNull Stringname()Returns the value of thenamerecord component.@Nullable StringReturns the value of thepermissionrecord component.@Nullable Doubleprice()Returns the value of thepricerecord component.@Nullable Stringrarity()Returns the value of therarityrecord component.@NotNull Stringsource()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.@NotNull CosmeticTypeKeytype()Returns the value of thetyperecord component.
-
Constructor Details
-
Cosmetic
public Cosmetic(@NotNull @NotNull CosmeticTypeKey type, @NotNull @NotNull String id, @NotNull @NotNull String name, @NotNull @NotNull org.bukkit.inventory.ItemStack icon, @NotNull @NotNull List<String> lore, @Nullable @Nullable String rarity, @Nullable @Nullable String permission, @Nullable @Nullable Double price, @NotNull @NotNull String source) Creates an instance of aCosmeticrecord class.- Parameters:
type- the value for thetyperecord componentid- the value for theidrecord componentname- the value for thenamerecord componenticon- the value for theiconrecord componentlore- the value for thelorerecord componentrarity- the value for therarityrecord componentpermission- the value for thepermissionrecord componentprice- the value for thepricerecord componentsource- the value for thesourcerecord component
-
-
Method Details
-
icon
@NotNull public @NotNull org.bukkit.inventory.ItemStack icon()A copy of the icon. -
getRarity
The rarity label, when there is one. -
getPermission
The permission that unlocks it, when there is one. -
getPrice
What it costs; empty when it is not for sale. -
isForSale
public boolean isForSale()Whether it can be bought with Zentrix's currency. -
isBuiltIn
public boolean isBuiltIn()Whether Zentrix itself provides it. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
lore
Returns the value of thelorerecord component.- Returns:
- the value of the
lorerecord component
-
rarity
Returns the value of therarityrecord component.- Returns:
- the value of the
rarityrecord component
-
permission
Returns the value of thepermissionrecord component.- Returns:
- the value of the
permissionrecord component
-
price
Returns the value of thepricerecord component.- Returns:
- the value of the
pricerecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-