|
4 jaren geleden | |
---|---|---|
.. | ||
LICENSE | 4 jaren geleden | |
README.md | 4 jaren geleden | |
errors.go | 4 jaren geleden | |
ping.go | 4 jaren geleden | |
ping_response.go | 4 jaren geleden | |
ping_test.go | 4 jaren geleden | |
ping_timer.go | 4 jaren geleden | |
player_sample.go | 4 jaren geleden |
A Golang library that facilitates Minecraft 1.7 server list pings.
go get github.com/ammario/mcping
package main
import (
"github.com/ammario/mcping"
"fmt"
)
func main() {
resp, err := mcping.Ping("us.mineplex.com:25565")
fmt.Println("Mineplex has", resp.Online, "players online")
}
The struct returned by the Ping()
function has the following schema
type PingResponse struct {
Latency uint //Latency in ms
Online int //Amount of online players
Max int //Maximum amount of players
Protocol int //E.g '4'
Favicon string //Base64 encoded favicon in data URI format
Motd string
Server string //E.g 'PaperSpigot'
Version string //E.g "1.7.10"
Sample []PlayerSample
}
type PlayerSample struct {
UUID string //e.g "d8a973a5-4c0f-4af6-b1ea-0a76cd210cc5"
Name string //e.g "Ammar"
}