mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-22 03:45:10 +01:00
Set the maximum number of player on the server through the config.json (#1001)
* Show server status to three-party game launcher * Set the maximum number of player on the server through the config.json * modify the logical order and show the number of maxplayer to API /status/server * Now even players who have token already cannot bypass the maxPlayer check
This commit is contained in:
@@ -9,6 +9,8 @@ import express.http.Request;
|
||||
import express.http.Response;
|
||||
import io.javalin.Javalin;
|
||||
|
||||
import static emu.grasscutter.Configuration.ACCOUNT;
|
||||
|
||||
/**
|
||||
* Handles all generic, hard-coded responses.
|
||||
*/
|
||||
@@ -48,8 +50,9 @@ public final class GenericHandler implements Router {
|
||||
|
||||
private static void serverStatus(Request request, Response response) {
|
||||
int playerCount = Grasscutter.getGameServer().getPlayers().size();
|
||||
int maxPlayer = ACCOUNT.maxPlayer;
|
||||
String version = GameConstants.VERSION;
|
||||
|
||||
response.send("{\"retcode\":0,\"status\":{\"playerCount\":" + playerCount + ",\"version\":\"" + version + "\"}}");
|
||||
response.send("{\"retcode\":0,\"status\":{\"playerCount\":" + playerCount + ",\"maxPlayer\":" + maxPlayer + ",\"version\":\"" + version + "\"}}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user