106 lines
3.9 KiB
Java
106 lines
3.9 KiB
Java
package uulm.teamname.marvelous.server.args;
|
|
|
|
import com.beust.jcommander.Parameter;
|
|
|
|
import java.io.File;
|
|
|
|
@SuppressWarnings({"FieldMayBeFinal", "unused"})
|
|
public class ServerArgs {
|
|
/** Whether help is requested */
|
|
@Parameter(names = {"-h", "--help", "-?", "--?", "-H"}, help = true)
|
|
private boolean help;
|
|
|
|
/** Defines the log level for the current execution of the Server */
|
|
@Parameter(names = {"-l", "--log-level"}, description = "Log Level: 0 = None, 1 = Error, 2 = Warning, 3 = Info, 4 = Debug, 5 = Trace")
|
|
private Integer logLevel = 3;
|
|
|
|
/** Equivalent to logLevel = 5. Maximum log level (trace) for everything */
|
|
@Parameter(names = {"-v", "--verbose"}, description = "Enables all log messages")
|
|
private boolean verbose = false;
|
|
|
|
/** Port that the server listens on */
|
|
@Parameter(names = {"--port", "-p"}, description = "Port the server listens at")
|
|
private int port = 1218;
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.PartyConfig PartyConfig} */
|
|
@Parameter(names = {"--conf-match", "-m", "--match-config"}, required = true)
|
|
private File matchConfigFile;
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.CharacterConfig CharacterConfig} */
|
|
@Parameter(names = {"--conf-chars", "-c", "--character-config"}, required = true)
|
|
private File characterConfigFile;
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig ScenarioConfig} */
|
|
@Parameter(names = {"--conf-scenario", "-s", "--scenario-config"}, required = true)
|
|
private File scenarioConfigFile;
|
|
|
|
/** Whether the server only checks the configuration files, and then stops execution */
|
|
@Parameter(names = {"-C", "--check-conf", "--check-config"}, description = "Validates the given config files and exits")
|
|
private boolean checkConfig = false;
|
|
|
|
/** The path to the folder in which replays are saved */
|
|
@Parameter(names = {"--replay", "-r"}, description = "Path for replay files to be saved at")
|
|
private String folderPath;
|
|
|
|
/** Whether help is requested */
|
|
public boolean isHelp() {
|
|
return help;
|
|
}
|
|
|
|
/** Defines the log level for the current execution of the Server */
|
|
public Integer getLogLevel() {
|
|
return logLevel;
|
|
}
|
|
|
|
/** Equivalent to logLevel = 5. Maximum log level (trace) for everything */
|
|
public boolean isVerbose() {
|
|
return verbose;
|
|
}
|
|
|
|
/** Port that the server listens on */
|
|
public int getPort() {
|
|
return port;
|
|
}
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.PartyConfig PartyConfig} */
|
|
public File getMatchConfigFile() {
|
|
return matchConfigFile;
|
|
}
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.CharacterConfig CharacterConfig} */
|
|
public File getCharacterConfigFile() {
|
|
return characterConfigFile;
|
|
}
|
|
|
|
/** File describing the {@link uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig ScenarioConfig} */
|
|
public File getScenarioConfigFile() {
|
|
return scenarioConfigFile;
|
|
}
|
|
|
|
/** Whether the server only checks the configuration files, and then stops execution */
|
|
public boolean isCheckConfig() {
|
|
return checkConfig;
|
|
}
|
|
|
|
/** The path to the folder in which replays are saved */
|
|
public String getFolderPath() {
|
|
return folderPath;
|
|
}
|
|
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "ServerArgs{" +
|
|
"help=" + help +
|
|
", logLevel=" + logLevel +
|
|
", verbose=" + verbose +
|
|
", port=" + port +
|
|
", matchConfigFile=" + matchConfigFile +
|
|
", characterConfigFile=" + characterConfigFile +
|
|
", scenarioConfigFile=" + scenarioConfigFile +
|
|
", checkConfig=" + checkConfig +
|
|
", folderPath='" + folderPath + '\'' +
|
|
'}';
|
|
}
|
|
}
|