Package net.okocraft.box.api.util
Class ItemNameGenerator
java.lang.Object
net.okocraft.box.api.util.ItemNameGenerator
A utility class for generating item names.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StringitemStack(@NotNull net.kyori.adventure.key.Keyed key, byte @NotNull [] bytes) Creates the name from theItemStack.static @NotNull StringCreates the name from theItemStack.static @NotNull Stringkey(@NotNull net.kyori.adventure.key.Key key) Creates the name from theKey.static @NotNull Stringkey(@NotNull net.kyori.adventure.key.Keyed key) Creates the name from theKeyed.static @NotNull Stringkeys(@NotNull net.kyori.adventure.key.Keyed key1, @NotNull net.kyori.adventure.key.Keyed key2) Creates the name from theKeyeds.static @NotNull Stringkeys(@NotNull net.kyori.adventure.key.Keyed key1, @NotNull net.kyori.adventure.key.Keyed key2, @NotNull net.kyori.adventure.key.Keyed @NotNull ... keys) Creates the name from theKeyeds.
-
Method Details
-
key
Creates the name from theKey.If
Key.namespace()isKey.MINECRAFT_NAMESPACE, this method returns only uppercaseKey.value(). Otherwise, returns the name in the formatNAMESPACE_VALUE.- Parameters:
key- theKeyto create the name- Returns:
- the created name
-
key
Creates the name from theKeyed.- Parameters:
key- theKeyedto create the name- Returns:
- the created name
- See Also:
-
keys
@NotNull public static @NotNull String keys(@NotNull @NotNull net.kyori.adventure.key.Keyed key1, @NotNull @NotNull net.kyori.adventure.key.Keyed key2) Creates the name from theKeyeds.This method returns the name of two
key(Keyed)results joined by_.- Parameters:
key1- the firstKeyedto create the namekey2- the secondKeyedto create the name- Returns:
- the created name
- See Also:
-
keys
@NotNull public static @NotNull String keys(@NotNull @NotNull net.kyori.adventure.key.Keyed key1, @NotNull @NotNull net.kyori.adventure.key.Keyed key2, @NotNull @NotNull net.kyori.adventure.key.Keyed @NotNull ... keys) Creates the name from theKeyeds.This method returns the name of
key(Keyed)results joined by_.- Parameters:
key1- the firstKeyedto create the namekey2- the secondKeyedto create the namekeys- the otherKeyeds to create the name- Returns:
- the created name
- See Also:
-
itemStack
Creates the name from theItemStack.This method passes
ItemStack.getType()andItemStack.serializeAsBytes()toitemStack(Keyed, byte[]).- Parameters:
itemStack- theItemStackto create the name- Returns:
- the created name
- See Also:
-
itemStack
@NotNull public static @NotNull String itemStack(@NotNull @NotNull net.kyori.adventure.key.Keyed key, byte @NotNull [] bytes) Creates the name from theItemStack.This method returns the name in the format
key_sha1.- Parameters:
key- theKeyedto create the namebytes- the bytes to create the hash value by SHA-1- Returns:
- the created name
-