package main import ( "encoding/json" "net/http" "strconv" ) func ReadLog(w http.ResponseWriter, r *http.Request) { log := MCServer.ReadAllLog() jsonData, _ := json.Marshal(log) sendJSONResponse(w, string(jsonData)) } func ReadLogFrom(w http.ResponseWriter, r *http.Request) { start, _ := mv(r, "start", false) startInt, _ := strconv.Atoi(start) end := MCServer.LenLog() if startInt > MCServer.LenLog()-1 { sendJSONResponse(w, "[]") } else { log := MCServer.ReadRangeLog(startInt, end) jsonData, _ := json.Marshal(log) sendJSONResponse(w, string(jsonData)) } } func ReadBanIP(w http.ResponseWriter, r *http.Request) { config := Config.ReadAllBannedIPs() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) } func ReadBanPlayer(w http.ResponseWriter, r *http.Request) { config := Config.ReadAllBannedPlayers() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) } func ReadEULA(w http.ResponseWriter, r *http.Request) { config := Config.ReadEULA() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) } func ReadOps(w http.ResponseWriter, r *http.Request) { config := Config.ReadAllOps() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) } func ReadProperties(w http.ResponseWriter, r *http.Request) { config := Config.ReadAllProperties() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) } func ReadWhitelist(w http.ResponseWriter, r *http.Request) { config := Config.ReadAllWhitelists() jsonData, _ := json.Marshal(config) sendJSONResponse(w, string(jsonData)) }