go-serverapi/ping.go

18 lines
437 B
Go

package serverapi
import "fmt"
// Ping is a Minecraft ping query
type Ping struct {
CurrentPlayers int `json:"current_players"`
MaxPlayers int `json:"max_players"`
Type string `json:"type"`
Version string `json:"version"`
MOTD string `json:"motd"`
}
// Ping returns a Ping
func (c *Client) Ping() (ping *Ping, err error) {
return ping, c.jsonGET(fmt.Sprintf("%s/ping", c.endpoint), &ping)
}