Features:
- Native Minecraft Version:
- Legacy (< 1.13)
- Tested Minecraft Versions:
- 1.8
- 1.12
- Contributors:
- SpigotEnte
Todo:
- Set amount
- Set DisplayName
- Set unbreakable Durability
- Set Lore
- Enable item glow
- Set skull owner
- Set color (banner, armor, wool)
- Add Enchantments
- Add item flat
- Set item meta
- Set durability
- Implement your ideas
- Support users
Code (Java):public class ItemBuilder {
private ItemStack itemStack;
private ItemMeta itemMeta;
public ItemBuilder(Material material, short subID) {
itemStack = new ItemStack(material, 1, subID);
itemMeta = itemStack.getItemMeta();
}
public ItemBuilder(Material material) {
this(material, (short) 0);
}
public ItemBuilder setAmount(int amount) {
itemStack.setAmount(amount);
return this;
}
public ItemBuilder setName(String name) {
itemMeta.setDisplayName(name);
return this;
}
public ItemBuilder setUnbreakable(boolean state) {
itemMeta.spigot().setUnbreakable(state);
return this;
}
public ItemBuilder setLore(String... lore) {
itemMeta.setLore(Arrays.asList(lore));
return this;
}
public ItemBuilder setLore(List<String> lore) {
itemMeta.setLore(lore);
return this;
}
public ItemBuilder setGlow() {
if (itemMeta.getEnchants().isEmpty()) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addEnchant(Enchantment.OXYGEN, 0, true);
}
return this;
}
public ItemBuilder setSkullOwner(String skullOwner) {
if (itemStack.getType().equals(Material.SKULL_ITEM)) {
SkullMeta skullMeta = ((SkullMeta) itemMeta);
skullMeta.setOwner(skullOwner);
}
return this;
}
public ItemBuilder addEnchantment(Enchantment enchantment, int level, boolean unsafe) {
itemMeta.addEnchant(enchantment, level, unsafe);
return this;
}
public ItemBuilder addEnchantments(Map<Enchantment, Integer> enchantments, boolean unsafe) {
for (Enchantment current : enchantments.keySet())
itemMeta.addEnchant(current, enchantments.get(current), unsafe);
return this;
}
public ItemBuilder setBannerColor(DyeColor color) {
try {
BannerMeta bannerMeta = ((BannerMeta) itemMeta);
bannerMeta.setBaseColor(color);
} catch (Exception exception) {
System.out.println("Can't change banner color" + exception);
}
return this;
}
public ItemBuilder setWoolColor(DyeColor color) {
if (itemStack.getType().equals(Material.WOOL)) {
//replace this to color.getDyeData(); when you want to use 1a higher version
itemStack.setDurability(color.getData());
}
return this;
}
public ItemBuilder setLeatherColor(Color color) {
try {
LeatherArmorMeta leatherArmorMeta = ((LeatherArmorMeta) itemMeta);
leatherArmorMeta.setColor(color);
} catch (Exception exception) {
System.out.println("Can't change leather color" + exception);
}
return this;
}
public ItemBuilder setDurability(int durability) {
itemStack.setDurability((short) durability);
return this;
}
public ItemBuilder addFlag(ItemFlag itemFlag) {
itemMeta.addItemFlags(itemFlag);
return this;
}
public ItemBuilder setItemMeta(ItemMeta itemMeta) {
itemStack.setItemMeta(itemMeta);
return this;
}
public ItemStack toItemStack() {
itemStack.setItemMeta(itemMeta);
return itemStack;
}
}

ItemBuilder - Simple & Effective 1.8 - 1.12.2
Create ItemStacks easily