mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 15:38:51 +00:00
Show server status to three-party game launcher
This commit is contained in:
parent
6be39eafd2
commit
ffd0212f94
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
|
|
||||||
|
import emu.grasscutter.GameConstants;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
||||||
import emu.grasscutter.Grasscutter.ServerRunMode;
|
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/register", (req, res) -> this.getAuthHandler().handleRegister(req, res));
|
||||||
httpServer.post("/authentication/change_password", (req, res) -> this.getAuthHandler().handleChangePassword(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
|
// Dispatch
|
||||||
httpServer.get("/query_region_list", (req, res) -> {
|
httpServer.get("/query_region_list", (req, res) -> {
|
||||||
// Log
|
// Log
|
||||||
|
Loading…
Reference in New Issue
Block a user