WolverinDEV / BungeeUtil

BungeeUtils [Unmaintained]
25 stars 13 forks source link

Failed to set SkinUrl of empty Skin #63

Open higgs01 opened 6 years ago

higgs01 commented 6 years ago

Hello

When i try to set the Skin-Url from a Empty skin:

ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short) 3) {
    @Override
    public void click(Click click) {

    }
};
SkullMeta meta = (SkullMeta) is.getItemMeta();
meta.setDisplayName(ProxyServer.getInstance().getPlayer(clientProfile.getLastName()) == null ? "§7" + clientProfile.getLastName() : "§6" + clientProfile.getLastName());
Skin skin = SkinFactory.createEmptySkin();
skin.setSkin(clientProfile.getTexture());
meta.setSkin(skin);

I get following error:

09:06:11 [SCHWERWIEGEND] Caused by: org.json.JSONException: JSONObject["textures"] not found.
09:06:11 [SCHWERWIEGEND]     at org.json.JSONObject.get(JSONObject.java:471)
09:06:11 [SCHWERWIEGEND]     at org.json.JSONObject.getJSONObject(JSONObject.java:636)
09:06:11 [SCHWERWIEGEND]     at dev.wolveringer.bungeeutil.profile.Skin.setSkin(Skin.java:207)
09:06:11 [SCHWERWIEGEND]     at my.own.package.FriendsGui.createPlayerSkull(FriendsGui.java:76)
09:06:11 [SCHWERWIEGEND]     at my.own.package.FriendsGui.buildGui(FriendsGui.java:40)
09:06:11 [SCHWERWIEGEND]     at my.own.package.FriendsGui.<init>(FriendsGui.java:31)
09:06:11 [SCHWERWIEGEND]     at my.own.package.FriendCommandList.onFriend(FriendCommandList.java:154)
09:06:11 [SCHWERWIEGEND]     ... 46 more

BungeeUtils-Version: 2.6.1 BungeeCord-Version: 1.12.-SNAPSHOT

kaerns commented 6 years ago

well makes sense that you can't have an skin without texture. if you want to set a steve-skin then you should get the actual texture for it and set it.

WolverinDEV commented 6 years ago

Hmm well I'm a little bit Co fused why the empty skin does not contains these properties. Well Im currently really buissy so it may take a bit of time before I research and fix this

kaerns commented 6 years ago

maybe found the reason: put "value" instead of "textures" as key: https://github.com/WolverinDEV/BungeeUtil/blob/2.0/src/main/java/dev/wolveringer/bungeeutil/profile/Skin.java#L205