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