Using ItemBuilder - TypicalFin/PluginCore GitHub Wiki

Example:

// You can optionally omit the item amount in the ItemBuilder constructor. The default item amount is 1.
final ItemStack apple = new ItemBuilder(Material.APPLE, 16)
        .setDisplayName("&aApple")
        .setLore("&fThis is an apple.")
        .addEnchantment(Enchantment.DURABILITY, 1)
        .addItemFlags(ItemFlag.HIDE_ENCHANTS)
        .build();

// Do note that all of these setters aren't mandatory. As an example, you can make an item with only a custom name.

The example code would result in the following item:

image

(16 apples with a green Apple display name and This is an apple. lore. Enchanted with Unbreaking I and an added item flag that hides enchantments)