use of com.mojang.authlib.properties.Property in project Denizen-For-Bukkit by DenizenScript.
the class Handler method getPlayerProfile.
@Override
public PlayerProfile getPlayerProfile(Player player) {
GameProfile gameProfile = ((CraftPlayer) player).getProfile();
Property property = Iterables.getFirst(gameProfile.getProperties().get("textures"), null);
return new PlayerProfile(gameProfile.getName(), gameProfile.getId(), property != null ? property.getValue() : null, property != null ? property.getSignature() : null);
}
use of com.mojang.authlib.properties.Property in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelperImpl method setSkullSkin.
@Override
public ItemStack setSkullSkin(ItemStack itemStack, PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
if (playerProfile.hasTexture()) {
gameProfile.getProperties().get("textures").clear();
if (playerProfile.getTextureSignature() != null) {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
} else {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture()));
}
}
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
net.minecraft.nbt.CompoundTag tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new net.minecraft.nbt.CompoundTag();
tag.put("SkullOwner", NbtUtils.writeGameProfile(new net.minecraft.nbt.CompoundTag(), gameProfile));
nmsItemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of com.mojang.authlib.properties.Property in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelperImpl method setSkullSkin.
@Override
public ItemStack setSkullSkin(ItemStack itemStack, PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
if (playerProfile.hasTexture()) {
gameProfile.getProperties().get("textures").clear();
if (playerProfile.getTextureSignature() != null) {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
} else {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture()));
}
}
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
net.minecraft.nbt.CompoundTag tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new net.minecraft.nbt.CompoundTag();
tag.put("SkullOwner", NbtUtils.writeGameProfile(new net.minecraft.nbt.CompoundTag(), gameProfile));
nmsItemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of com.mojang.authlib.properties.Property in project Denizen-For-Bukkit by DenizenScript.
the class ProfileEditorImpl method getGameProfile.
private static GameProfile getGameProfile(PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
return gameProfile;
}
use of com.mojang.authlib.properties.Property in project askyblock by tastybento.
the class SkullBlock method getNonPlayerProfile.
// Credits: dori99xd
public static GameProfile getNonPlayerProfile(String textureValue, String ownerUUID, String ownerName) {
// Create a new GameProfile with .schematic informations or with fake informations
GameProfile newSkinProfile = new GameProfile(ownerUUID == null ? UUID.randomUUID() : UUID.fromString(ownerUUID), ownerName == null ? getRandomString(16) : null);
// Insert textures properties
newSkinProfile.getProperties().put("textures", new Property("textures", textureValue));
return newSkinProfile;
}
Aggregations