Util ItemBuilder - Chainable Item Constructor

Discussion in 'Resources' started by MineStein, May 31, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    MineStein

    Hello everyone. I figured I should share a tool that I use in my plugins, an item builder! This allows you to construct items in an easier fashion.

    Get the code here.

    To get started, create a new ItemBuilder instance, like this
    Code:
    ItemBuilder builder = new ItemBuilder();
    All item builders can be turned into ItemStacks by calling the build methods
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.DIRT).name("§c§lSome Cool Name").build();
    To set the item type, call the "type" method
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.DIRT).build();
    To set the item amount, call the "amount" method
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.DIRT).amount(2).build();
    To set the item data, call the "data" method
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.STAINED_GLASS_PANE).amount(1).data((byte) 14).build();
    To set the item name, call the "name" method
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.STAINED_GLASS_PANE).amount(1).name("§cSome awesome name").data((byte) 14).build();
    To set the item lore, call the "lore" method
    Code:
    ItemStack itemStack = new ItemBuilder().type(Material.STAINED_GLASS_PANE).amount(1).name("§cSome awesome name").lore("Some", "awesome", "lore").data((byte) 14).build();
    That's all! Thanks for reading this thread.
     
    teej107 likes this.
  2. Offline

    ChipDev

    This thread has been made many times.
     
    nverdier and xTrollxDudex like this.
  3. Offline

    nverdier

  4. Offline

    Konato_K

    @FisheyLP Because if you're using an API already it's kind of annoying to add another one just for item stacks I guess
     
  5. Offline

    nverdier

    @FisheyLP I use that for my own use and I prefer to make everything on my own, so yes, I do have it in my library. It doesn't mean people have to use my class, I don't think it's the best out there, it doesn't have the most features.
     
Thread Status:
Not open for further replies.

Share This Page