1.7.10 Changing player skins won't work for players that actually have skins

Discussion in 'Spigot Plugin Development' started by itspinger, Jul 31, 2020 at 8:51 PM.

  1. I'm making a Disguise plugin, and I'm doing it for 1.7 / 1.8 version (I KNOW I KNOW ITS OLD)

    So basically I'm running into an issue where I can change the skin of the players who don't have default skins, but the ones that do, they only get the cape of the player they are targeting and their skin doesn't change.

    This is my User class in which I do all the skin update:
    https://hastebin.com/jawudimica.java

    When I change the skin of the player who has Steve skin:
    https://imgur.com/a/oG5GlW4

    When I want to change the skin of the player that doesn't default skin (you can see the cape changes tho):
    https://imgur.com/a/6Pyvcct

    Class is a mess right now, but I'll change it when I actually get the functionality
     
  2. From what I know, skins consist of 2 parts. The texture "value" and the "signature".
    For example when you request my skin from the mojang api, you can see these 2 values listed below my name:
    https://sessionserver.mojang.com/se...c492fff60e469fa1bc0b5bcaf20c8f?unsigned=false

    It seems like you are currently only getting/using the "value" value and not the signature. Try getting and implementing the signature the same way you get the texture value.
     
  3. Nopee I'm getting the signature too, otherwise it would kick the player.
     
  4. What I'm currently using to get data
    Code (Text):
    package net.pinger.disguise.helper;

    import kong.unirest.*;
    import kong.unirest.json.JSONArray;
    import kong.unirest.json.JSONObject;
    import net.minecraft.util.com.mojang.authlib.properties.Property;
    import org.apache.commons.codec.binary.Base64;
    import org.bukkit.Bukkit;

    import javax.annotation.Nullable;
    import java.util.UUID;

    public class ProfileFetcher {

        private final static String NAME_URL = "https://api.mojang.com/users/profiles/minecraft/";
        private final static String ID_URL = "https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false";

        @Nullable
        public static UUID getUUIDFromName(String name) {
            String str = NAME_URL + name;

            HttpResponse<JsonNode> node = Unirest.get(str).asJson();
            if (!node.isSuccess()) {
                return null;
            }

            String uuid = node.getBody().getObject().getString("id");

            String fixedUUID = uuid.substring(0, 8) +  "-" +
                                uuid.substring(8, 12) + "-" +
                                uuid.substring(12, 16) + "-" +
                                uuid.substring(16, 20) + "-" +
                                uuid.substring(20, 32);

            return UUID.fromString(fixedUUID);
        }

        @Nullable
        public static Property getPropertyFromUUID(UUID uuid) {
            String str = String.format(ID_URL, uuid);

            HttpResponse<JsonNode> node = Unirest.get(str).asJson();
            if (!node.isSuccess()) {
                return null;
            }

            JSONObject properties = node.getBody().getObject().getJSONArray("properties").getJSONObject(0);

            Bukkit.getLogger().info(properties.toString());

            String name = properties.getString("name");
            String value = properties.getString("value");
            String signature = properties.getString("signature");

            return new Property(name, value, signature);
        }

    }
     
     
  5. I had the same issue in my project when I forgot to add the signature. (It didn't kick the player in my case)
    You said that you manage it properly, the client uses his UUID to request the skin to Mojang himself if the player info packet doesn't contain enough data
     
  6. You can see all of my code tho..
    I'm also printing out the whole JSON and the response is always sucessful, i get both value and signature