go-serverapi/ping.go

18 lines
434 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.json(fmt.Sprintf("%s/ping", c.Endpoint), &ping)
}