mc_misc.go 587 B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "encoding/json"
  4. "net/http"
  5. "aytechnology.us/gominecraft/mod/mc"
  6. "aytechnology.us/gominecraft/mod/mcping"
  7. )
  8. func SendCommand(w http.ResponseWriter, r *http.Request) {
  9. command, _ := mv(r, "command", false)
  10. MCServer.SendCommand(command)
  11. sendJSONResponse(w, "OK")
  12. }
  13. func ServerInfo(w http.ResponseWriter, r *http.Request) {
  14. resp, _ := mcping.Ping("localhost:25565")
  15. for _, item := range resp.Sample {
  16. skin := mc.NewHandler(item.UUID, "./server/skin/")
  17. skin.DownloadSkin()
  18. }
  19. jsonData, _ := json.Marshal(resp)
  20. sendJSONResponse(w, string(jsonData))
  21. }