now the new yggdrasil package and /cmd s can pass go test >_<

This commit is contained in:
Tnze
2019-08-09 00:53:39 +08:00
parent c02d1fa43a
commit dac6580ff8
2 changed files with 11 additions and 11 deletions

View File

@ -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)

View File

@ -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
}