Skip to content

Commit 715da23

Browse files
Add ItemBuilder constructors with ItemType
1 parent c3dee7d commit 715da23

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

invui/src/main/java/xyz/xenondevs/invui/item/ItemBuilder.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.bukkit.Material;
2525
import org.bukkit.craftbukkit.inventory.CraftItemStack;
2626
import org.bukkit.inventory.ItemStack;
27+
import org.bukkit.inventory.ItemType;
2728
import org.jspecify.annotations.Nullable;
2829
import xyz.xenondevs.invui.i18n.Languages;
2930
import xyz.xenondevs.invui.internal.util.ArrayUtils;
@@ -56,6 +57,25 @@ public final class ItemBuilder implements ItemProvider {
5657

5758
private Map<Locale, ItemStack> buildCache = new HashMap<>();
5859

60+
/**
61+
* Constructs a new {@link ItemBuilder} based on the given {@link ItemType}.
62+
*
63+
* @param type The {@link ItemType}
64+
*/
65+
public ItemBuilder(ItemType type) {
66+
this(type.createItemStack());
67+
}
68+
69+
/**
70+
* Constructs a new {@link ItemBuilder} based on the given {@link ItemType} and amount.
71+
*
72+
* @param type The {@link ItemType}
73+
* @param amount The amount
74+
*/
75+
public ItemBuilder(ItemType type, int amount) {
76+
this(type.createItemStack(amount));
77+
}
78+
5979
/**
6080
* Constructs a new {@link ItemBuilder} based on the given {@link Material}.
6181
*

0 commit comments

Comments
 (0)