Skip to content

Instantly share code, notes, and snippets.

@AllieQpzm
Last active August 29, 2015 14:02
Show Gist options
  • Save AllieQpzm/c679a750a913b4d10ca5 to your computer and use it in GitHub Desktop.
Save AllieQpzm/c679a750a913b4d10ca5 to your computer and use it in GitHub Desktop.
public static ItemStack createItemStack(Material type, int amount, byte data, String name, String... lore) {
if(type == null)
return null;
ItemStack is = new ItemStack(type, amount, data);
ItemMeta meta = is.getItemMeta();
if(lore != null && lore.length > 0)
meta.setLore(Arrays.asList(lore));
if(name != null && !name.isEmpty())
meta.setDisplayName(name);
is.setItemMeta(meta);
return is;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment