From dac6580ff8ec7d9707806e01fc9419d9ae4fcadc Mon Sep 17 00:00:00 2001 From: Tnze Date: Fri, 9 Aug 2019 00:53:39 +0800 Subject: [PATCH] now the new yggdrasil package and /cmd s can pass go test >_< --- bot/example_test.go | 6 +++--- yggdrasil/authenticate.go | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bot/example_test.go b/bot/example_test.go index 721d640..c0e1529 100644 --- a/bot/example_test.go +++ b/bot/example_test.go @@ -47,9 +47,9 @@ func ExampleClient_JoinServer_online() { if err != nil { panic(err) } - c.Name = auth.SelectedProfile.Name - c.Auth.UUID = auth.SelectedProfile.ID - c.AsTk = auth.AccessToken + + c.Auth.UUID, c.Name = auth.SelectedProfile() + c.AsTk = auth.AccessToken() //Connect server err = c.JoinServer("localhost", 25565) diff --git a/yggdrasil/authenticate.go b/yggdrasil/authenticate.go index ac0a11c..25da0f6 100644 --- a/yggdrasil/authenticate.go +++ b/yggdrasil/authenticate.go @@ -39,18 +39,18 @@ type authResp struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` // identical to the one received AvailableProfiles []struct { - ID uuid.UUID `json:"ID"` // hexadecimal - Name string `json:"name"` - Legacy bool `json:"legacy"` // In practice, this field only appears in the response if true. Default to false. + ID string `json:"ID"` // hexadecimal + Name string `json:"name"` + Legacy bool `json:"legacy"` // In practice, this field only appears in the response if true. Default to false. } `json:"availableProfiles"` // only present if the agent field was received SelectedProfile struct { // only present if the agent field was received - ID uuid.UUID `json:"id"` - Name string `json:"name"` - Legacy bool `json:"legacy"` + ID string `json:"id"` + Name string `json:"name"` + Legacy bool `json:"legacy"` } `json:"selectedProfile"` User struct { // only present if requestUser was true in the request authPayload - ID uuid.UUID `json:"id"` // hexadecimal + ID string `json:"id"` // hexadecimal Properties []struct { Name string `json:"name"` Value string `json:"value"` @@ -86,7 +86,7 @@ func Authenticate(user, password string) (*Access, error) { return &Access{ar: ar, ct: pl.ClientToken}, nil } -func (a *Access) SelectedProfile() (ID uuid.UUID, Name string) { +func (a *Access) SelectedProfile() (ID, Name string) { return a.ar.SelectedProfile.ID, a.ar.SelectedProfile.Name }