Package dev.oumaimaa.kawaiiapi.items
Class ItemUtils.ItemBuilder
java.lang.Object
dev.oumaimaa.kawaiiapi.items.ItemUtils.ItemBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionItemBuilder(@NotNull org.bukkit.Material material) Creates a new ItemBuilder.ItemBuilder(@NotNull org.bukkit.inventory.ItemStack item) Creates a new ItemBuilder from an existing item. -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemUtils.ItemBuilderAdds lines to existing lore.@NotNull ItemUtils.ItemBuilderamount(int amount) Sets the amount of the item.@NotNull org.bukkit.inventory.ItemStackbuild()Builds and returns the final ItemStack.@NotNull ItemUtils.ItemBuildercustomModelData(int data) Sets custom model data.@NotNull ItemUtils.ItemBuilderenchant(@NotNull org.bukkit.enchantments.Enchantment enchantment, int level) Adds an enchantment to the item.@NotNull ItemUtils.ItemBuilderglow()Adds a glow effect.@NotNull ItemUtils.ItemBuilderHides all item flags.@NotNull ItemUtils.ItemBuilderhideFlags(@NotNull org.bukkit.inventory.ItemFlag... flags) Hides specific item flags.@NotNull ItemUtils.ItemBuilderSets the lore using color codes.@NotNull ItemUtils.ItemBuilderSets the lore using Components.@NotNull ItemUtils.ItemBuilderSets the display name using color codes.@NotNull ItemUtils.ItemBuildername(@NotNull net.kyori.adventure.text.Component name) Sets the display name using a Component.@NotNull ItemUtils.ItemBuilderMakes the item unbreakable.
-
Constructor Details
-
ItemBuilder
public ItemBuilder(@NotNull @NotNull org.bukkit.Material material) Creates a new ItemBuilder.- Parameters:
material- The material for the item
-
ItemBuilder
public ItemBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack item) Creates a new ItemBuilder from an existing item.- Parameters:
item- The item to base this builder on
-
-
Method Details
-
amount
Sets the amount of the item.- Parameters:
amount- The amount (automatically clamped to valid range)- Returns:
- This builder instance
-
name
Sets the display name using color codes.- Parameters:
name- The display name (supports & and invalid input: '&#'RRGGBB)- Returns:
- This builder instance
-
name
@NotNull public @NotNull ItemUtils.ItemBuilder name(@NotNull @NotNull net.kyori.adventure.text.Component name) Sets the display name using a Component.- Parameters:
name- The display name Component- Returns:
- This builder instance
-
lore
Sets the lore using color codes.- Parameters:
lore- The lore lines (supports & and invalid input: '&#'RRGGBB)- Returns:
- This builder instance
-
lore
@NotNull public @NotNull ItemUtils.ItemBuilder lore(@NotNull @NotNull List<net.kyori.adventure.text.Component> lore) Sets the lore using Components.- Parameters:
lore- The lore Components- Returns:
- This builder instance
-
addLore
Adds lines to existing lore.- Parameters:
lines- The lines to add- Returns:
- This builder instance
-
glow
Adds a glow effect.- Returns:
- This builder instance
-
unbreakable
Makes the item unbreakable.- Returns:
- This builder instance
-
customModelData
Sets custom model data.- Parameters:
data- The custom model data value- Returns:
- This builder instance
-
hideFlags
Hides all item flags.- Returns:
- This builder instance
-
hideFlags
@NotNull public @NotNull ItemUtils.ItemBuilder hideFlags(@NotNull @NotNull org.bukkit.inventory.ItemFlag... flags) Hides specific item flags.- Parameters:
flags- The flags to hide- Returns:
- This builder instance
-
enchant
@NotNull public @NotNull ItemUtils.ItemBuilder enchant(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment, int level) Adds an enchantment to the item.- Parameters:
enchantment- The enchantment to addlevel- The enchantment level- Returns:
- This builder instance
-
build
@NotNull public @NotNull org.bukkit.inventory.ItemStack build()Builds and returns the final ItemStack.- Returns:
- The constructed ItemStack
-