package main import ( "net/http" "aytechnology.us/gominecraft/mod/mcping" ) func StartMCServer(w http.ResponseWriter, r *http.Request) { MCServer.StartService(serverConfig.Folder) 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(serverConfig.Folder) 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") }