Skip to content

ItemBuilder

Redempt edited this page Dec 23, 2020 · 2 revisions

Where ItemUtils make it a fair bit easier to modify items, ItemBuilder makes it a breeze to create them. Code like this:

ItemStack item = new ItemStack(Material.BLAZE_ROD);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("Cool name");
List<String> lore = new ArrayList<>();
lore.add("Cool lore");
meta.setLore(lore);
item.setItemMeta(meta);

can be simplified to this:

ItemStack item = new ItemBuilder(Material.BLAZE_ROD)
	.setName("Cool name")
	.setLore("Cool lore")

And really, there's not much more to be said about it.

Clone this wiki locally