@@ -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 {
0 commit comments