Skip to content

Commit 5cf3554

Browse files
Something (forgor)
1 parent 848e51e commit 5cf3554

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/main/java/me/flame/menus/items/MenuItem.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.flame.menus.items;
22

33
import me.flame.menus.components.nbt.ItemNbt;
4+
import org.bukkit.Material;
45
import org.bukkit.event.inventory.InventoryClickEvent;
56
import org.bukkit.inventory.ItemStack;
67

@@ -24,8 +25,8 @@
2425
* ...
2526
* });
2627
*
27-
* // implementing a new itemStack:
28-
* menu.addItem(new ItemBuilder(itemStack, 2) // 2 is the amount of items you get from this "ItemBuilder"
28+
* // implementing a new MenuItem:
29+
* menu.addItem(ItemBuilder.of(itemStack, 2) // 2 is the amount of items you get from this "ItemBuilder"
2930
* .setName(...).setLore(...)
3031
* .buildItem(() -> ...);
3132
* // the lambda (Consumer) at ItemBuilder#buildItem(Consumer) is optional and you do not have to provide an action, you can use ItemBuilder#buildItem()
@@ -34,18 +35,12 @@
3435
@SuppressWarnings("unused")
3536
public final class MenuItem {
3637
private @Nullable Consumer<InventoryClickEvent> clickAction;
37-
38-
public void setItemStack(ItemStack itemStack) {
39-
this.itemStack = ItemNbt.setString(itemStack, "woody-menu", uuid.toString());;
40-
41-
}
42-
4338
private ItemStack itemStack;
4439
private final UUID uuid = UUID.randomUUID();
4540

4641
public MenuItem(ItemStack itemStack, @Nullable Consumer<InventoryClickEvent> action) {
4742
Objects.requireNonNull(itemStack);
48-
this.itemStack = ItemNbt.setString(itemStack, "woody-menu", uuid.toString());;
43+
this.itemStack = ItemNbt.setString(itemStack, "woody-menu", uuid.toString());
4944
this.clickAction = action;
5045
}
5146

@@ -69,4 +64,12 @@ public ItemStack getItemStack() {
6964
public UUID getUniqueId() {
7065
return uuid;
7166
}
67+
68+
public void setItemStack(ItemStack itemStack) {
69+
this.itemStack = ItemNbt.setString(itemStack, "woody-menu", uuid.toString());
70+
}
71+
72+
public Material getType() {
73+
return itemStack.getType();
74+
}
7275
}

0 commit comments

Comments
 (0)