Record Class CosmeticTypeKey
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.cosmetics.CosmeticTypeKey
- Record Components:
namespace- who defines the type:zentrix, or the addon's namespacekey- the type within its namespace
Names a cosmetic type: one of Zentrix's own
categories, under the
zentrix namespace, or one an addon registered, under the addon's namespace. Written
namespace:key, such as zentrix:gliders or myhats:hats.
Both parts use a-z, 0-9, _ and -. An addon's cosmetics are
stored under its key, so keep it stable across versions.
- Since:
- 1.11.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCosmeticTypeKey(@NotNull String namespace, @NotNull String key) Creates an instance of aCosmeticTypeKeyrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringasString()The key asnamespace:key.final booleanIndicates whether some other object is "equal to" this one.@NotNull Optional<CosmeticCategory> The built-in category this names; empty for an addon's type.final inthashCode()Returns a hash code value for this object.booleanWhether this names one of Zentrix's own categories.@NotNull Stringkey()Returns the value of thekeyrecord component.@NotNull StringReturns the value of thenamespacerecord component.static @NotNull StringnamespaceOf(@NotNull org.bukkit.plugin.Plugin plugin) The namespaceof(Plugin, String)gives a plugin's types.static @NotNull CosmeticTypeKeyof(@NotNull CosmeticCategory category) The key of one of Zentrix's own categories.static @NotNull CosmeticTypeKeyA key in a plugin's own namespace: its name in lowercase, with every character outsidea-z,0-9,_and-replaced by_.static @NotNull Optional<CosmeticTypeKey> Reads a key written asnamespace:key, ignoring case.toString()Returns a string representation of this record class.
-
Field Details
-
ZENTRIX
The namespace of Zentrix's own categories.- See Also:
-
-
Constructor Details
-
Method Details
-
of
The key of one of Zentrix's own categories. -
of
@NotNull public static @NotNull CosmeticTypeKey of(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String key) A key in a plugin's own namespace: its name in lowercase, with every character outsidea-z,0-9,_and-replaced by_.- Parameters:
key- the type within the plugin's namespace
-
namespaceOf
@NotNull public static @NotNull String namespaceOf(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) The namespaceof(Plugin, String)gives a plugin's types. -
parse
Reads a key written asnamespace:key, ignoring case. A key without a namespace, such asgliders, names one of Zentrix's own categories.- Returns:
- empty when the text is not a key
-
isBuiltIn
public boolean isBuiltIn()Whether this names one of Zentrix's own categories. -
getCategory
The built-in category this names; empty for an addon's type. -
asString
The key asnamespace:key. -
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). -
namespace
Returns the value of thenamespacerecord component.- Returns:
- the value of the
namespacerecord component
-
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-