> For the complete documentation index, see [llms.txt](https://plugins-1.gitbook.io/plugins/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://plugins-1.gitbook.io/plugins/apis/lib/items/item-builder.md).

# Item Builder

Creating custom itemstacks can be a pain, especially when it involves a name, lore, enchantments, item flags and even NBT tags. Our item builder makes this an absolute breeze, and will certainly minimise development time with plugins.

### How about giving players an enchanted sword, that has hidden enchantments with an NBT tag?

Easy! Like so..

```java
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player player = e.getPlayer();
        ItemBuilder itemBuilder = new ItemBuilder(Material.DIAMOND_SWORD)
                .withName("&cLucky Sword")
                .withLore("&7A powerful, strong sword.")
                .withEnchant(Enchantment.KNOCKBACK, 1)
                .withFlag(ItemFlag.HIDE_ENCHANTS)
                .withData(0)
                .withNBTString("sword-type", "strong");

        // Add our custom item to the players inventory.
        player.getInventory().addItem(itemBuilder.getItem());
    }
```
