// Legacy 1.8.8 compatibility via reflection:
public ItemStack resolveLegacy(UUID uuid, String name) {
try {
Class<?> gameProfileClass = Class.forName("com.mojang.authlib.GameProfile");
Object profile = gameProfileClass
.getConstructor(UUID.class, String.class)
.newInstance(uuid, name);
// Inject texture from SkinsRestorer
Method getSkinData(playerName = skinRestorerAPI.getSkinData(name);
return injectTexture(profile, skinData.getValue(), skinData.getSignature());
SkullMeta meta = (SkullMeta) Bukkit.getItemFactory()
.getItemMeta(Material.SKULL_ITEM);
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} catch (Exception e) {
// Fallback to Steve
}
}