add item amount to button utils

This commit is contained in:
jascotty2 2019-09-08 07:27:36 -05:00
parent 9860484061
commit f0abcde1b0

View File

@ -103,6 +103,22 @@ public class GuiUtils {
return item;
}
public static ItemStack createButtonItem(LegacyMaterials mat, int amount, String title, String... lore) {
ItemStack item = mat.getItem();
item.setAmount(amount);
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.setDisplayName(title);
if (lore != null) {
meta.setLore(getSafeLore(lore));
} else {
meta.setLore(Collections.EMPTY_LIST);
}
item.setItemMeta(meta);
}
return item;
}
public static ItemStack createButtonItem(ItemStack from, String title, String... lore) {
ItemStack item = from.clone();
ItemMeta meta = item.getItemMeta();
@ -133,6 +149,22 @@ public class GuiUtils {
return item;
}
public static ItemStack createButtonItem(LegacyMaterials mat, int amount, String title, List<String> lore) {
ItemStack item = mat.getItem();
item.setAmount(amount);
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.setDisplayName(title);
if (lore != null) {
meta.setLore(getSafeLore(lore));
} else {
meta.setLore(Collections.EMPTY_LIST);
}
}
item.setItemMeta(meta);
return item;
}
public static ItemStack createButtonItem(ItemStack from, String title, List<String> lore) {
ItemStack item = from.clone();
ItemMeta meta = item.getItemMeta();