Skip to content

Commit 6320bf2

Browse files
committed
fix: do not throw an error when invalid uuid on player resolve (temp accs)
1 parent f89b48b commit 6320bf2

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/api/mowojang.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ func GetUUID(username string) (string, error) {
3232
return post.UUID, fmt.Errorf("error reading response: %v", err)
3333
}
3434

35+
if resp.StatusCode == http.StatusNotFound || string(body) == "player not found" {
36+
return "Player not Found", nil
37+
}
38+
3539
var json = jsoniter.ConfigCompatibleWithStandardLibrary
3640
err = json.Unmarshal(body, &post)
3741
if err != nil {
@@ -63,6 +67,10 @@ func GetUsername(uuid string) (string, error) {
6367
return post.Name, fmt.Errorf("error reading response: %v", err)
6468
}
6569

70+
if resp.StatusCode == http.StatusNotFound || string(body) == "player not found" {
71+
return "Player not Found", nil
72+
}
73+
6674
var json = jsoniter.ConfigCompatibleWithStandardLibrary
6775
err = json.Unmarshal(body, &post)
6876
if err != nil {
@@ -105,6 +113,13 @@ func ResolvePlayer(uuid string) (*models.MowojangReponse, error) {
105113
return &post, fmt.Errorf("error reading response: %v", err)
106114
}
107115

116+
if resp.StatusCode == http.StatusNotFound || string(body) == "player not found" {
117+
return &models.MowojangReponse{
118+
Name: "Player not Found",
119+
UUID: uuid,
120+
}, nil
121+
}
122+
108123
var json = jsoniter.ConfigCompatibleWithStandardLibrary
109124
err = json.Unmarshal(body, &post)
110125
if err != nil {

src/stats/other.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func FormatMembers(profile *skycrypttypes.Profile) ([]*models.MemberStats, error
6666

6767
memberStats = append(memberStats, &models.MemberStats{
6868
UUID: mowojang.UUID,
69-
CuteName: profile.ProfileID,
69+
CuteName: profile.CuteName,
7070
ProfileId: profile.ProfileID,
7171
Name: mowojang.Name,
7272
Removed: isMemberRemoved(&memberData),

0 commit comments

Comments
 (0)