Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. public static ItemStack Skull(String skullOwner)
  2. {
  3. ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
  4. SkullMeta skullMeta = (SkullMeta)skull.getItemMeta();
  5. skullMeta.setOwner(skullOwner);
  6. skull.setItemMeta(skullMeta);
  7. return skull;
  8. }
  9.  
  10. public ItemStack getItem()
  11. {
  12. ItemStack item = null;
  13. if(config.getString("Material").startsWith("Player:"))
  14. {
  15. String tmp = config.getString("Material");
  16. String tb[] = tmp.split(":");
  17. item = Skull(tb[1]);
  18. } else
  19. {
  20. Material material = Material.getMaterial(config.getString("Material"));
  21. if(material == null || material == Material.AIR)
  22. {
  23. plugin.log.severe((new StringBuilder(String.valueOf(config.getInt("Material")))).append(" not a valid Material. Example: ").append(Material.APPLE.toString()).toString());
  24. }
  25. item = new ItemStack(material, 1);
  26. }
  27. ItemMeta meta = item.getItemMeta();
  28. meta.setDisplayName((new StringBuilder()).append(ChatColor.GREEN).append(name).toString());
  29. List arg0 = new ArrayList();
  30. String desc = config.getString("Description");
  31. if(desc == null)
  32. {
  33. plugin.log.severe("Description not set");
  34. }
  35. arg0.add((new StringBuilder()).append(ChatColor.RESET).append(Translate.replaceColors(desc)).toString());
  36. meta.setLore(arg0);
  37. item.setItemMeta(meta);
  38. return item;
  39. }
  40.  
  41. public void disable()
  42. {
  43. HandlerList.unregisterAll(this);
  44. }
  45.  
  46. public void saveConfig()
  47. {
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement