Custom playerheads skins

Discussion in 'Plugin Development' started by Badwolf330, Feb 17, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    Badwolf330

    is there any why to make a playerhead with a skin from a link? i did grab this code from internet

    Code:
     public static ItemStack getCustomSkull(String url) {
            GameProfile profile = new GameProfile(UUID.randomUUID(), null);
            PropertyMap propertyMap = profile.getProperties();
            if (propertyMap == null) {
                throw new IllegalStateException("Profile doesn't contain a property map");
            }
            byte[] encodedData = base64.encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
            propertyMap.put("textures", new Property("textures", new String(encodedData)));
            ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
            ItemMeta headMeta = head.getItemMeta();
            Class<?> headMetaClass = headMeta.getClass();
            Reflections.getField(headMetaClass, "profile", GameProfile.class).set(headMeta, profile);
            head.setItemMeta(headMeta);
            return head;
        }
    
    that works for this:
    http://textures.minecraft.net/textu...e1e273e3025617d8071516f953251b52545da8d3e8db8

    but it isn't working for this:
    http://i.imgur.com/w9HuNGl.png

    does someone knows a athor way?
     
  2. Offline

    AppleBabies

    @Badwolf330 Holy complications...

    Minecraft only has two ways to catch skins:
    • From a player name
    • From a player's UUID
    Nothing else will work, sorry. A URL to a skin site is not considered a profile. If that was allowed, Minecraft would be the most un-secure game ever.
     
  3. Offline

    Lightspeed

    Maybe it is possible in some way.
     
  4. Offline

    AppleBabies

  5. Offline

    Lightspeed

    I don't see anything in here saying I can't do reflection to do some magic.
     
  6. Offline

    AppleBabies

Thread Status:
Not open for further replies.

Share This Page