|
@@ -13,11 +13,15 @@ func (mc *Handler) DownloadSkin() {
|
|
|
resp := httpReq("https://sessionserver.mojang.com/session/minecraft/profile/" + mc.UUID)
|
|
|
var profileArray profile
|
|
|
json.Unmarshal(resp, &profileArray)
|
|
|
-
|
|
|
- decoded, _ := base64.URLEncoding.DecodeString(profileArray.Properties[0].Value)
|
|
|
- var textureArray texture
|
|
|
- json.Unmarshal([]byte(decoded), &textureArray)
|
|
|
- downloadFile(mc.savePath+"/"+mc.UUID+".png", textureArray.Textures.SKIN.URL)
|
|
|
+ if len(profileArray.Error) > 0 {
|
|
|
+ log.Println("Error when reading profiles. Download aborted.")
|
|
|
+ copy("default_skin.png", mc.savePath+"/"+mc.UUID+".png")
|
|
|
+ } else {
|
|
|
+ decoded, _ := base64.URLEncoding.DecodeString(profileArray.Properties[0].Value)
|
|
|
+ var textureArray texture
|
|
|
+ json.Unmarshal([]byte(decoded), &textureArray)
|
|
|
+ downloadFile(mc.savePath+"/"+mc.UUID+".png", textureArray.Textures.SKIN.URL)
|
|
|
+ }
|
|
|
} else {
|
|
|
log.Println("Skin exists, not downloading")
|
|
|
}
|