@SuppressWarnings({ "deprecation", "resource" })
    private static void fixSkin(GameProfile profile, String skinOwner) {
        try {
            URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + Bukkit.getOfflinePlayer(skinOwner).getUniqueId().toString().replace("-", ""));
            URLConnection uc = url.openConnection();
 
            // Parse it
            Scanner scanner = new Scanner(uc.getInputStream(), "UTF-8").useDelimiter("\\A");
            String json = scanner.next();
 
            JSONArray properties = (JSONArray) ((JSONObject) new JSONParser().parse(json)).get("properties");
            for (int i = 0; i < properties.size(); i++) {
                JSONObject property = (JSONObject) properties.get(i);
                String name = (String) property.get("name");
                String value = (String) property.get("value");
                String signature = property.containsKey("signature") ? (String) property.get("signature") : null;
                if (signature != null) {
                    profile.getProperties().put(name, new Property(name, value, signature));
                } else {
                    profile.getProperties().put(name, new Property(value, name));
                }
            }
        } catch (Exception e) {
        }
    }