realms support
This commit is contained in:
36
realms/mco.go
Normal file
36
realms/mco.go
Normal file
@ -0,0 +1,36 @@
|
||||
package realms
|
||||
|
||||
import "io/ioutil"
|
||||
|
||||
// Available returns whether the user can access the Minecraft Realms service
|
||||
func (r *Realms) Available() (ok bool, err error) {
|
||||
err = r.get("/mco/available", &ok)
|
||||
return
|
||||
}
|
||||
|
||||
// Compatible returns whether the clients version is up to date with Realms.
|
||||
// if the client is outdated, it returns OUTDATED,
|
||||
// if the client is running a snapshot, it returns OTHER,
|
||||
// else it returns COMPATIBLE.
|
||||
func (r *Realms) Compatible() (string, error) {
|
||||
resp, err := r.c.Get(Domain + "/mco/client/compatible")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
rp, err := ioutil.ReadAll(resp.Body)
|
||||
|
||||
return string(rp), err
|
||||
}
|
||||
|
||||
// TOS is what to join Realms servers you must agree to.
|
||||
// Call this function will set this flag.
|
||||
func (r *Realms) TOS()error{
|
||||
resp,err:=r.c.Post(Domain+"/mco/tos/agreed","application/json",nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user