Class ItemUtil
java.lang.Object
net.mathias2246.buildmc.api.item.ItemUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voideditMeta(@NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull Consumer<@NotNull org.bukkit.inventory.meta.ItemMeta> consumer) static voidsetItemLegacyComponentName(@NotNull org.bukkit.inventory.ItemStack itemStack, @Nullable net.kyori.adventure.text.Component newName) Will set the item name of the givenItemStackto the givenComponentname.
-
Constructor Details
-
ItemUtil
public ItemUtil()
-
-
Method Details
-
editMeta
public static void editMeta(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull @NotNull Consumer<@NotNull org.bukkit.inventory.meta.ItemMeta> consumer) A helper method for editingItemMetausing aConsumerthat takes in anItemMetainstance.The edited
ItemMetainstance will be automatically be set on theItemStackinstance after editing.If the meta returned by
itemStack.getItemMeta();equals null, nothing will happen.- Parameters:
itemStack- TheItemStackthat should be editedconsumer- The consumer used to edit theItemMeta
-
setItemLegacyComponentName
public static void setItemLegacyComponentName(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @Nullable @Nullable net.kyori.adventure.text.Component newName) Will set the item name of the givenItemStackto the givenComponentname.- Parameters:
newName- The new name of the item. When null, the name will be removed from the item.
-