123456789101112131415161718192021222324252627282930 |
- package main
- import (
- "encoding/json"
- "net/http"
- "aytechnology.us/gominecraft/mod/mc"
- "aytechnology.us/gominecraft/mod/mcping"
- )
- func SendCommand(w http.ResponseWriter, r *http.Request) {
- command, _ := mv(r, "command", false)
- MCServer.SendCommand(command)
- sendJSONResponse(w, "OK")
- }
- func ServerInfo(w http.ResponseWriter, r *http.Request) {
- pingResp, _ := mcping.Ping("localhost:" + Config.ReadProperties("server-port"))
- for _, item := range pingResp.Sample {
- skin := mc.NewHandler(item.UUID, serverConfig.Folder+"/skin/")
- skin.DownloadSkin()
- }
- resp := ServerInfoStruct{
- Info: pingResp,
- IsRunning: MCServer.IsRunning(),
- }
- jsonData, _ := json.Marshal(resp)
- sendJSONResponse(w, string(jsonData))
- }
|