Class ItemCategory.Builder
java.lang.Object
com.github.darksoulq.abyssallib.world.item.ItemCategory.Builder
- Enclosing class:
ItemCategory
A fluent builder for creating
ItemCategory instances.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(net.kyori.adventure.key.Key id) Constructs a builder with a mandatory Key. -
Method Summary
Modifier and TypeMethodDescriptionAdds a single item to the category.Adds multiple items to the category.addAll(Collection<Item> items) Adds a collection of items to the category.build()Finalizes the creation of the ItemCategory.Sets the icon using a specific Item instance.Sets the icon using a lazy supplier.icon(org.bukkit.inventory.ItemStack icon) Sets the icon using a static ItemStack.
-
Constructor Details
-
Builder
public Builder(net.kyori.adventure.key.Key id) Constructs a builder with a mandatory Key.- Parameters:
id- TheKeyto assign to the category.
-
-
Method Details
-
icon
Sets the icon using a lazy supplier.- Parameters:
icon- ASupplierproviding theItemStack.- Returns:
- This builder for chaining.
-
icon
Sets the icon using a static ItemStack.- Parameters:
icon- TheItemStackto use as an icon.- Returns:
- This builder for chaining.
-
icon
Sets the icon using a specific Item instance.- Parameters:
icon- TheItemto extract the stack from.- Returns:
- This builder for chaining.
-
add
Adds a single item to the category.- Parameters:
item- TheItemto add.- Returns:
- This builder for chaining.
-
add
Adds multiple items to the category.- Parameters:
items- The array ofItems to add.- Returns:
- This builder for chaining.
-
addAll
Adds a collection of items to the category.- Parameters:
items- The collection ofItems to add.- Returns:
- This builder for chaining.
-
build
Finalizes the creation of the ItemCategory.- Returns:
- A new
ItemCategoryinstance. - Throws:
NullPointerException- If the icon has not been set prior to building.
-