Commit 7e3bfed0 authored by coooookies's avatar coooookies Committed by Melledy
Browse files

Show server status to three-party game launcher

parent 04f6e734
......@@ -4,6 +4,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.protobuf.ByteString;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.Grasscutter.ServerDebugMode;
import emu.grasscutter.Grasscutter.ServerRunMode;
......@@ -258,6 +259,15 @@ public final class DispatchServer {
httpServer.post("/authentication/register", (req, res) -> this.getAuthHandler().handleRegister(req, res));
httpServer.post("/authentication/change_password", (req, res) -> this.getAuthHandler().handleChangePassword(req, res));
// Server Status
httpServer.get("/status/server", (req, res) -> {
int playerCount = Grasscutter.getGameServer().getPlayers().size();
String version = GameConstants.VERSION;
res.send("{\"retcode\":0,\"status\":{\"playerCount\":" + playerCount + ",\"version\":\"" + version + "\"}}");
});
// Dispatch
httpServer.get("/query_region_list", (req, res) -> {
// Log
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment