2018-09-17 10:07:32 +03:00
|
|
|
package com.mojang.authlib.yggdrasil;
|
|
|
|
|
2019-06-02 05:03:08 +03:00
|
|
|
import pro.gravit.launcher.Launcher;
|
|
|
|
import pro.gravit.launcher.profiles.PlayerProfile;
|
|
|
|
import pro.gravit.utils.helper.SecurityHelper;
|
2018-09-17 10:07:32 +03:00
|
|
|
|
2019-10-19 19:46:04 +03:00
|
|
|
import java.util.UUID;
|
|
|
|
|
2019-12-08 22:21:05 +03:00
|
|
|
|
2019-09-18 00:53:03 +03:00
|
|
|
public class CompatProfile {
|
2018-09-25 17:06:13 +03:00
|
|
|
public static final String SKIN_URL_PROPERTY = Launcher.SKIN_URL_PROPERTY;
|
|
|
|
public static final String SKIN_DIGEST_PROPERTY = Launcher.SKIN_DIGEST_PROPERTY;
|
|
|
|
public static final String CLOAK_URL_PROPERTY = Launcher.CLOAK_URL_PROPERTY;
|
|
|
|
public static final String CLOAK_DIGEST_PROPERTY = Launcher.CLOAK_DIGEST_PROPERTY;
|
2018-09-17 10:07:32 +03:00
|
|
|
// Instance
|
|
|
|
public final UUID uuid;
|
|
|
|
public final String uuidHash, username;
|
|
|
|
public final String skinURL, skinDigest;
|
|
|
|
public final String cloakURL, cloakDigest;
|
|
|
|
|
|
|
|
public CompatProfile(UUID uuid, String username, String skinURL, String skinDigest, String cloakURL, String cloakDigest) {
|
|
|
|
this.uuid = uuid;
|
|
|
|
uuidHash = Launcher.toHash(uuid);
|
|
|
|
this.username = username;
|
|
|
|
this.skinURL = skinURL;
|
|
|
|
this.skinDigest = skinDigest;
|
|
|
|
this.cloakURL = cloakURL;
|
|
|
|
this.cloakDigest = cloakDigest;
|
|
|
|
}
|
|
|
|
|
2020-04-05 10:27:04 +03:00
|
|
|
public static CompatProfile fromPlayerProfile(PlayerProfile profile) {
|
|
|
|
return profile == null ? null : new CompatProfile(profile.uuid, profile.username,
|
|
|
|
profile.skin == null ? null : profile.skin.url,
|
|
|
|
profile.skin == null ? null : SecurityHelper.toHex(profile.skin.digest),
|
|
|
|
profile.cloak == null ? null : profile.cloak.url,
|
|
|
|
profile.cloak == null ? null : SecurityHelper.toHex(profile.cloak.digest)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-09-17 10:07:32 +03:00
|
|
|
public int countProperties() {
|
|
|
|
int count = 0;
|
|
|
|
if (skinURL != null)
|
2018-09-22 17:33:00 +03:00
|
|
|
count++;
|
2018-09-17 10:07:32 +03:00
|
|
|
if (skinDigest != null)
|
2018-09-22 17:33:00 +03:00
|
|
|
count++;
|
2018-09-17 10:07:32 +03:00
|
|
|
if (cloakURL != null)
|
2018-09-22 17:33:00 +03:00
|
|
|
count++;
|
2018-09-17 10:07:32 +03:00
|
|
|
if (cloakDigest != null)
|
2018-09-22 17:33:00 +03:00
|
|
|
count++;
|
2018-09-17 10:07:32 +03:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|