use of com.comphenix.protocol.wrappers.WrappedGameProfile in project ChangeSkin by games647.
the class BukkitSkinAPI method applySkin.
@Override
public void applySkin(Player receiver, SkinModel targetSkin) {
WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(receiver);
applyProperties(gameProfile, targetSkin);
}
use of com.comphenix.protocol.wrappers.WrappedGameProfile in project ChangeSkin by games647.
the class SkullCommand method setSkullSkin.
private void setSkullSkin(ItemStack itemStack, SkinModel skinData) {
if (itemStack == null || skinData == null || itemStack.getType() != Material.SKULL_ITEM)
return;
try {
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.randomUUID(), null);
plugin.getApi().applyProperties(gameProfile, skinData);
skullProfileSetter.invoke(skullMeta, gameProfile.getHandle());
itemStack.setItemMeta(skullMeta);
} catch (Exception ex) {
plugin.getLog().info("Failed to set skull item {} to {}", itemStack, skinData, ex);
} catch (Throwable throwable) {
// rethrow errors we shouldn't silence them like OutOfMemory
throw (Error) throwable;
}
}
Aggregations