Update the response

This commit is contained in:
libraryaddict 2021-05-22 01:47:15 +12:00
parent 84f32a70fa
commit e91c022d92

View File

@ -3,6 +3,7 @@ package me.libraryaddict.disguise.utilities.mineskin;
import com.google.gson.annotations.SerializedName;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;
import java.util.Map;
@ -11,57 +12,54 @@ import java.util.UUID;
/**
* Created by libraryaddict on 29/12/2019.
*/
@Getter
public class MineSkinResponse {
@Getter
public class SkinTextureUrls {
private String skin;
private String cape;
}
@Getter
public class SkinTexture {
private String value;
private String signature;
private String url;
private SkinTextureUrls urls;
}
@Getter
public class SkinData {
public class SkinTexture {
private String value;
private String signature;
private String url;
private Map<String, String> urls;
public String getValue() {
return value;
}
public String getSignature() {
return signature;
}
public String getUrl() {
return url;
}
public Map<String, String> getUrls() {
return urls;
}
}
private String name;
private UUID uuid;
private SkinTexture texture;
public String getName() {
return name;
}
public SkinTexture getTexture() {
return texture;
}
public UUID getUUID() {
return uuid;
}
}
public enum SkinVariant {
UNKNOWN,
CLASSIC,
SLIM
}
private int id;
private String idStr;
private String uuid;
private String name;
private SkinVariant variant;
private SkinData data;
private double timestamp;
private int duration;
@SerializedName("account")
private int accountId;
private String server;
@SerializedName("private")
private boolean privateSkin;
private int views;
private boolean duplicate;
private double nextRequest;
public int getId() {
@ -81,39 +79,13 @@ public class MineSkinResponse {
return null;
}
GameProfile profile = new GameProfile(getData().getUUID(),
StringUtils.stripToNull(getData().getName()) == null ? "Unknown" : getData().getName());
GameProfile profile = new GameProfile(getData().getUUID(), StringUtils.stripToNull(getData().getName()) == null ? "Unknown" : getData().getName());
if (getData().getTexture() != null) {
Property property = new Property("textures", getData().getTexture().getValue(),
getData().getTexture().getSignature());
Property property = new Property("textures", getData().getTexture().getValue(), getData().getTexture().getSignature());
profile.getProperties().put("textures", property);
}
return profile;
}
public double getTimestamp() {
return timestamp;
}
public int getDuration() {
return duration;
}
public int getAccountId() {
return accountId;
}
public boolean isPrivate() {
return privateSkin;
}
public int getViews() {
return views;
}
public double getNextRequest() {
return nextRequest;
}
}