Advertisement
Red_Jheyson

Untitled

Jan 12th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.     public static ItemStack makeItem(String type, String name, List<String> lore){
  2.         int ty = 0;
  3.         if(type.contains(":")){
  4.             String[] b = type.split(":");
  5.             type = b[0];
  6.             ty = Integer.parseInt(b[1]);
  7.         }
  8.         Material m = Material.matchMaterial(type);
  9.         ItemStack item = null;
  10.         try{
  11.             item = new ItemStack(m, 1, (short) ty);
  12.             ItemMeta itemmeta = item.getItemMeta();
  13.             itemmeta.setDisplayName(name);
  14.             if(lore != null){
  15.                 itemmeta.setLore(lore);
  16.             }
  17.             item.setItemMeta(itemmeta);
  18.         }catch(Exception e){
  19.             item = new ItemStack(Material.BEDROCK);
  20.         }
  21.         return item;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement