PlasmaVNGaming

Untitled

Aug 7th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public static ItemStack createNonOwnerSkull(String name, String url, ArrayList<String> lores) {
  2.  
  3. ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
  4. item.setDurability((short)3);
  5. SkullMeta meta = (SkullMeta) item.getItemMeta();
  6. meta.setDisplayName("§a" + name);
  7. meta.setLore(lores);
  8. GameProfile gp = new GameProfile(java.util.UUID.randomUUID(), null);
  9. gp.getProperties().put("textures", new Property("textures", new String(url)));
  10. Field lf = null;
  11.  
  12. try {
  13.  
  14. lf = meta.getClass().getDeclaredField("profile");
  15. lf.setAccessible(true);
  16. lf.set(meta, gp);
  17.  
  18. } catch (NoSuchFieldException e) {
  19.  
  20. } catch (IllegalArgumentException e) {
  21.  
  22. } catch (IllegalAccessException e) {
  23.  
  24. }
  25.  
  26. item.setItemMeta(meta);
  27. return item;
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment