1234567891011121314151617181920212223242526272829303132333435363738 |
- package main
- import (
- "net/http"
- "aytechnology.us/gominecraft/mod/mcping"
- )
- func StartMCServer(w http.ResponseWriter, r *http.Request) {
- MCServer.StartService()
- sendJSONResponse(w, "OK")
- }
- func StopMCServer(w http.ResponseWriter, r *http.Request) {
- MCServer.SendCommand("stop")
- sendJSONResponse(w, "OK")
- }
- func KillMCServer(w http.ResponseWriter, r *http.Request) {
- MCServer.KillServer()
- sendJSONResponse(w, "OK")
- }
- func RestartMCServer(w http.ResponseWriter, r *http.Request) {
- MCServer.SendCommand("stop")
- MCServer.Wait()
- MCServer.StartService()
- sendJSONResponse(w, "OK")
- }
- func KickAllMCServer(w http.ResponseWriter, r *http.Request) {
- resp, _ := mcping.Ping("localhost:25565")
- for _, user := range resp.Sample {
- MCServer.SendCommand("kick " + user.Name + " Bye Bye " + user.Name + "~")
- }
- sendJSONResponse(w, "OK")
- }
|