Hello, I'm programming a function in spigot which basically returns a player head with a skin with provided texturevalue, but it doesn't work and i don't really know how to fix it/do it at all. Can someone help me out?
Code I came up with so far:
ItemStack customHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) customHead.getItemMeta();
try {
PlayerProfile owner = HLevels.getPlugin().getServer().createPlayerProfile(textureValue);
meta.setOwnerProfile(owner);
customHead.setItemMeta(meta);
return customHead;
} catch (NullPointerException e)
{
return null;
}
}```