Solved Set URL to Skull

Discussion in 'Spigot Plugin Development' started by MaTaMoR_, Jun 6, 2016.

  1. Hi, i was trying to set a skin URL from mojang (like this) to a skull, but i can't manage to make it work, i have seen many posts where people do it, and i have adapted it to my needs but being the same at the end, but somehow it doesn't work, and it's driving me crazy.

    //This is my code
    Code (Text):

    private static FieldAccesor<GameProfile> profileField = Reflections.getField(Reflections.getCraftBukkitClass("inventory.CraftMetaSkull"), "profile", GameProfile.class);

    GameProfile profile = new GameProfile(UUID.randomUUID(), null);

    byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", data.getValue()).getBytes());
    profile.getProperties().put("textures", new Property("textures", new String(encodedData)));

    profileField.set(skullMeta, profile);
    BUT IT DOESN'T WORK (madness intensifies) so, please send halp!

    Edit: APPARENTLY i didn't notice i should be using SKULL_ITEM instead of SKULL, gg for myself.
    #1 MaTaMoR_, Jun 6, 2016
    Last edited: Jun 6, 2016