Documentation ¶
Overview ¶
Package mcapi has methods for requesting information from mcapi.us
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var APIEndpoint = "https://mcapi.us"
APIEndpoint is the endpoint to use for requesting any information.
Functions ¶
func GetServerQuery ¶
func GetServerQuery(ip string, port int) (*types.ServerQuery, error)
GetServerQuery allows you to query a server to get more detailed information.
Note that this function requires you to have query enabled on your server.
Example ¶
status, err := GetServerQuery("mc.syfaro.net", 25565) if err != nil { panic(err) } fmt.Printf("You have %d/%d players on a server running %s!", status.Players.Now, status.Players.Max, status.ServerMod)
Output: You have 0/20 players on a server running CraftBukkit on Bukkit 1.8.3-R0.1-SNAPSHOT!
func GetServerStatus ¶
func GetServerStatus(ip string, port int) (*types.ServerStatus, error)
GetServerStatus allows you to ping a server and get basic information.
Example ¶
status, err := GetServerStatus("mc.syfaro.net", 25565) if err != nil { panic(err) } fmt.Printf("You have %d/%d players online!", status.Players.Now, status.Players.Max)
Output: You have 0/20 players online!
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.