MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / getMinecraftServerStatus

Function getMinecraftServerStatus

plugin/minecraftobserver/ping.go:49–63  ·  view source on GitHub ↗

getMinecraftServerStatus 获取Minecraft服务器状态

(addr string)

Source from the content-addressed store, hash-verified

47
48// getMinecraftServerStatus 获取Minecraft服务器状态
49func getMinecraftServerStatus(addr string) (*serverPingAndListResp, error) {
50 var s serverPingAndListResp
51 resp, delay, err := bot.PingAndListTimeout(addr, time.Second*5)
52 if err != nil {
53 // logrus.Errorln(logPrefix+"PingAndList error: ", err)
54 return nil, err
55 }
56 err = json.Unmarshal(resp, &s)
57 if err != nil {
58 // logrus.Errorln(logPrefix+"Parse json response fail: ", err)
59 return nil, err
60 }
61 s.Delay = delay
62 return &s, nil
63}

Callers 3

initFunction · 0.85
singleServerScanFunction · 0.85
Test_PingListInfoFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_PingListInfoFunction · 0.68