More efficient way to create ItemStacks?

Discussion in 'Spigot Plugin Development' started by kinukin, Jun 9, 2017.

  1. Code (Text):
                ItemStack skill = new ItemStack(Material.getMaterial(test.icon()));
                ItemMeta skillMeta = skill.getItemMeta();
    Is there a shorter and better way of doing this?
  2. ScarabCoder

    ScarabCoder Retired Resource Staff

    Not part of Bukkit; however, you could create your own function and make it look something like this:
    Code (Text):
    public ItemStack getStack(Material type, String displayName)
  3. Not really :/, API's can do stuff like this sometimes
  4. This is good for when you have a lot of items to create but I wouldn't do this if I only have to create one item
    • Agree Agree x 1
    • Informative Informative x 1
  5. And if you only have to create one item, then this thread was answered before it was posted.
    • Agree Agree x 1