Package dev.triumphteam.gui.builder.item
Class BaseItemBuilder<B extends BaseItemBuilder<B>>
java.lang.Object
dev.triumphteam.gui.builder.item.BaseItemBuilder<B>
- Type Parameters:
B
- The ItemBuilder type so the methods can cast to the subtype
- Direct Known Subclasses:
ItemBuilder
,SkullBuilder
public abstract class BaseItemBuilder<B extends BaseItemBuilder<B>>
extends java.lang.Object
Contains all the common methods for the future ItemBuilders
-
Method Summary
Modifier and Type Method Description B
amount(int amount)
Sets the amount of itemsGuiItem
asGuiItem()
Creates aGuiItem
instead of anItemStack
GuiItem
asGuiItem(@NotNull GuiAction<org.bukkit.event.inventory.InventoryClickEvent> action)
Creates aGuiItem
instead of anItemStack
org.bukkit.inventory.ItemStack
build()
Builds the item intoItemStack
B
disenchant(@NotNull org.bukkit.enchantments.Enchantment enchantment)
Disenchants a certainEnchantment
from theItemStack
B
enchant(@NotNull org.bukkit.enchantments.Enchantment enchantment)
Enchants theItemStack
B
enchant(@NotNull org.bukkit.enchantments.Enchantment enchantment, int level)
Enchants theItemStack
B
enchant(@NotNull org.bukkit.enchantments.Enchantment enchantment, int level, boolean ignoreLevelRestriction)
Enchants theItemStack
B
flags(@NotNull org.bukkit.inventory.ItemFlag... flags)
Add anItemFlag
to the itemB
glow()
Makes theItemStack
glowB
glow(boolean glow)
Adds or removes theItemStack
glowB
lore(@NotNull java.util.function.Consumer<java.util.List<net.kyori.adventure.text.Component>> lore)
Consumer for freely adding to the loreB
lore(@NotNull java.util.List<net.kyori.adventure.text.Component> lore)
Set the lore lines of an itemB
lore(@NotNull net.kyori.adventure.text.Component... lore)
Set the lore lines of an itemB
model(int modelData)
Sets the custom model data of the item Added in 1.13B
name(@NotNull net.kyori.adventure.text.Component name)
Sets the display name of the item usingComponent
B
pdc(@NotNull java.util.function.Consumer<org.bukkit.persistence.PersistentDataContainer> consumer)
Consumer for applyingPersistentDataContainer
to the item This method will only work on versions above 1.14B
removeNbt(@NotNull java.lang.String key)
Removes NBT tag from theItemStack
B
setNbt(@NotNull java.lang.String key, boolean value)
Sets NBT tag to theItemStack
B
setNbt(@NotNull java.lang.String key, @Nullable java.lang.String value)
Sets NBT tag to theItemStack
B
unbreakable()
Makes theItemStack
unbreakableB
unbreakable(boolean unbreakable)
Sets the item as unbreakable
-
Method Details
-
name
Sets the display name of the item usingComponent
- Parameters:
name
- TheComponent
name- Returns:
ItemBuilder
- Since:
- 3.0.0
-
amount
Sets the amount of items- Parameters:
amount
- the amount of items- Returns:
ItemBuilder
- Since:
- 3.0.0
-
lore
Set the lore lines of an item- Parameters:
lore
- Lore lines as varargs- Returns:
ItemBuilder
- Since:
- 3.0.0
-
lore
@Contract("_ -> this") public B lore(@NotNull @NotNull java.util.List<net.kyori.adventure.text.Component> lore)Set the lore lines of an item- Parameters:
lore
- AList
with the lore lines- Returns:
ItemBuilder
- Since:
- 3.0.0
-
lore
@Contract("_ -> this") public B lore(@NotNull @NotNull java.util.function.Consumer<java.util.List<net.kyori.adventure.text.Component>> lore)Consumer for freely adding to the lore- Parameters:
lore
- AConsumer
with theList
of loreComponent
- Returns:
ItemBuilder
- Since:
- 3.0.0
-
enchant
@Contract("_, _, _ -> this") public B enchant(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment, int level, boolean ignoreLevelRestriction)Enchants theItemStack
- Parameters:
enchantment
- TheEnchantment
to addlevel
- The level of theEnchantment
ignoreLevelRestriction
- If should or not ignore it- Returns:
ItemBuilder
- Since:
- 3.0.0
-
enchant
@Contract("_, _ -> this") public B enchant(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment, int level)Enchants theItemStack
- Parameters:
enchantment
- TheEnchantment
to addlevel
- The level of theEnchantment
- Returns:
ItemBuilder
- Since:
- 3.0.0
-
enchant
@Contract("_ -> this") public B enchant(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment)Enchants theItemStack
- Parameters:
enchantment
- TheEnchantment
to add- Returns:
ItemBuilder
- Since:
- 3.0.0
-
disenchant
@Contract("_ -> this") public B disenchant(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment)Disenchants a certainEnchantment
from theItemStack
- Parameters:
enchantment
- TheEnchantment
to remove- Returns:
ItemBuilder
- Since:
- 3.0.0
-
flags
Add anItemFlag
to the item- Parameters:
flags
- TheItemFlag
to add- Returns:
ItemBuilder
- Since:
- 3.0.0
-
unbreakable
Makes theItemStack
unbreakable- Returns:
ItemBuilder
- Since:
- 3.0.0
-
unbreakable
Sets the item as unbreakable- Parameters:
unbreakable
- If should or not be unbreakable- Returns:
ItemBuilder
-
glow
Makes theItemStack
glow- Returns:
ItemBuilder
- Since:
- 3.0.0
-
glow
Adds or removes theItemStack
glow- Parameters:
glow
- Should the item glow- Returns:
ItemBuilder
-
pdc
@Contract("_ -> this") public B pdc(@NotNull @NotNull java.util.function.Consumer<org.bukkit.persistence.PersistentDataContainer> consumer)Consumer for applyingPersistentDataContainer
to the item This method will only work on versions above 1.14- Parameters:
consumer
- TheConsumer
with the PDC- Returns:
ItemBuilder
- Since:
- 3.0.0
-
model
Sets the custom model data of the item Added in 1.13- Parameters:
modelData
- The custom model data from the resource pack- Returns:
ItemBuilder
- Since:
- 3.0.0
-
setNbt
@Contract("_, _ -> this") public B setNbt(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String value)Sets NBT tag to theItemStack
- Parameters:
key
- The NBT keyvalue
- The NBT value- Returns:
ItemBuilder
-
setNbt
Sets NBT tag to theItemStack
- Parameters:
key
- The NBT keyvalue
- The NBT value- Returns:
ItemBuilder
-
removeNbt
Removes NBT tag from theItemStack
- Parameters:
key
- The NBT key- Returns:
ItemBuilder
-
build
public org.bukkit.inventory.ItemStack build()Builds the item intoItemStack
- Returns:
- The fully built
ItemStack
-
asGuiItem
Creates aGuiItem
instead of anItemStack
-
asGuiItem
@Contract("_ -> new") public GuiItem asGuiItem(@NotNull @NotNull GuiAction<org.bukkit.event.inventory.InventoryClickEvent> action)Creates aGuiItem
instead of anItemStack
-