feat: added max lobbies parameter

This commit is contained in:
Yannik Bretschneider 2021-06-06 17:43:55 +02:00
parent a6ecf6fa30
commit 7a27ca8ecf
2 changed files with 17 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig;
import uulm.teamname.marvelous.gamelibrary.json.JSON; import uulm.teamname.marvelous.gamelibrary.json.JSON;
import uulm.teamname.marvelous.gamelibrary.json.ValidationUtility; import uulm.teamname.marvelous.gamelibrary.json.ValidationUtility;
import uulm.teamname.marvelous.server.args.ServerArgs; import uulm.teamname.marvelous.server.args.ServerArgs;
import uulm.teamname.marvelous.server.lobbymanager.LobbyManager;
import uulm.teamname.marvelous.server.netconnector.MarvelousServer; import uulm.teamname.marvelous.server.netconnector.MarvelousServer;
import uulm.teamname.marvelous.server.netconnector.UserManager; import uulm.teamname.marvelous.server.netconnector.UserManager;
@ -27,10 +28,11 @@ import java.util.Map;
* -s .\configs\asgard.scenario.json -v} into the arguments field. * -s .\configs\asgard.scenario.json -v} into the arguments field.
*/ */
public class Server { public class Server {
private static PartyConfig partyConfig; private static PartyConfig partyConfig;
private static ScenarioConfig scenarioConfig; private static ScenarioConfig scenarioConfig;
private static CharacterConfig characterConfig; private static CharacterConfig characterConfig;
private static int maxLobbies;
public static void main(String[] args) { public static void main(String[] args) {
@ -46,7 +48,9 @@ public class Server {
System.exit(1); System.exit(1);
} }
System.out.println(serverArgs); // System.out.println(serverArgs);
maxLobbies = serverArgs.getMaxLobbies();
if (serverArgs.isVerbose() || serverArgs.isCheckConfig()) { if (serverArgs.isVerbose() || serverArgs.isCheckConfig()) {
// If checkConfig, the LogLevel is also set to max, because more information // If checkConfig, the LogLevel is also set to max, because more information
@ -225,4 +229,8 @@ public class Server {
public static CharacterConfig getCharacterConfig() { public static CharacterConfig getCharacterConfig() {
return characterConfig; return characterConfig;
} }
public static int getMaxLobbies() {
return maxLobbies;
}
} }

View File

@ -49,6 +49,9 @@ public class ServerArgs {
@Parameter(names = {"--replay", "-r"}) @Parameter(names = {"--replay", "-r"})
private String folderPath; private String folderPath;
@Parameter(names = {"--max-lobbies", "-l", "--team25-max-lobbies"} )
private int maxLobbies = 8;
/** Whether help is requested */ /** Whether help is requested */
public boolean isHelp() { public boolean isHelp() {
return help; return help;
@ -94,6 +97,10 @@ public class ServerArgs {
return folderPath; return folderPath;
} }
public int getMaxLobbies() {
return maxLobbies;
}
@Override @Override
public String toString() { public String toString() {