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 String
itemStack
(@NotNull net.kyori.adventure.key.Keyed key, byte @NotNull [] bytes) Creates the name from theItemStack
.static @NotNull String
itemStack
(@NotNull org.bukkit.inventory.ItemStack itemStack) Creates the name from theItemStack
.static @NotNull String
key
(@NotNull net.kyori.adventure.key.Key key) Creates the name from theKey
.static @NotNull String
key
(@NotNull net.kyori.adventure.key.Keyed key) Creates the name from theKeyed
.static @NotNull String
keys
(@NotNull net.kyori.adventure.key.Keyed key1, @NotNull net.kyori.adventure.key.Keyed key2) Creates the name from theKeyed
s.static @NotNull String
keys
(@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 theKeyed
s.
-
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
- theKey
to create the name- Returns:
- the created name
-
key
Creates the name from theKeyed
.- Parameters:
key
- theKeyed
to 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 theKeyed
s.This method returns the name of two
key(Keyed)
results joined by_
.- Parameters:
key1
- the firstKeyed
to create the namekey2
- the secondKeyed
to 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 theKeyed
s.This method returns the name of
key(Keyed)
results joined by_
.- Parameters:
key1
- the firstKeyed
to create the namekey2
- the secondKeyed
to create the namekeys
- the otherKeyed
s to create the name- Returns:
- the created name
- See Also:
-
itemStack
@NotNull public static @NotNull String itemStack(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Creates the name from theItemStack
.This method passes
ItemStack.getType()
andItemStack.serializeAsBytes()
toitemStack(Keyed, byte[])
.- Parameters:
itemStack
- theItemStack
to 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
- theKeyed
to create the namebytes
- the bytes to create the hash value by SHA-1- Returns:
- the created name
-