mc_read.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package main
  2. import (
  3. "encoding/json"
  4. "net/http"
  5. )
  6. func ReadLog(w http.ResponseWriter, r *http.Request) {
  7. log := MCServer.ReadAllLog()
  8. jsonData, _ := json.Marshal(log)
  9. sendJSONResponse(w, string(jsonData))
  10. }
  11. func ReadBanIP(w http.ResponseWriter, r *http.Request) {
  12. config := Config.ReadAllBannedIPs()
  13. jsonData, _ := json.Marshal(config)
  14. sendJSONResponse(w, string(jsonData))
  15. }
  16. func ReadBanPlayer(w http.ResponseWriter, r *http.Request) {
  17. config := Config.ReadAllBannedPlayers()
  18. jsonData, _ := json.Marshal(config)
  19. sendJSONResponse(w, string(jsonData))
  20. }
  21. func ReadEULA(w http.ResponseWriter, r *http.Request) {
  22. config := Config.ReadEULA()
  23. jsonData, _ := json.Marshal(config)
  24. sendJSONResponse(w, string(jsonData))
  25. }
  26. func ReadOps(w http.ResponseWriter, r *http.Request) {
  27. config := Config.ReadAllOps()
  28. jsonData, _ := json.Marshal(config)
  29. sendJSONResponse(w, string(jsonData))
  30. }
  31. func ReadProperties(w http.ResponseWriter, r *http.Request) {
  32. config := Config.ReadAllProperties()
  33. jsonData, _ := json.Marshal(config)
  34. sendJSONResponse(w, string(jsonData))
  35. }
  36. func ReadWhitelist(w http.ResponseWriter, r *http.Request) {
  37. config := Config.ReadAllWhitelists()
  38. jsonData, _ := json.Marshal(config)
  39. sendJSONResponse(w, string(jsonData))
  40. }