Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void serverArguments(String[] args) {
- String combinedArguments = "";
- for (int index = 0; index < args.length; index++) {
- combinedArguments = combinedArguments + args[index]; // creates a new StringBuilder object each loop iteration
- }
- if (args.length > 0) {
- List<String> argumentsAsList = Arrays.asList(args); // should be used more, no need for combinedArguments
- int port = Integer.parseInt(args[0]); // will fail without telling user HOW they messed up args
- ServerConfiguration.PORT = port; // PORT = Integer.parseInt(args[0]); local variable port is useless
- if (combinedArguments.contains("ECO")) {
- GameType.gameType = GameType.OSRS_ECO;
- }
- else if (combinedArguments.contains("PVP")) {
- GameType.gameType = GameType.OSRS_PVP;
- } else if (combinedArguments.contains("PRE_EOC")) {
- GameType.gameType = GameType.PRE_EOC;
- }
- if (combinedArguments.contains("LIVE")) { // no if needed: DEBUG_MODE = !combinedArguments.contains("LIVE");
- ServerConfiguration.DEBUG_MODE = false;
- }
- if (argumentsAsList.contains("BENCHMARK")) { // no if needed
- ServerConfiguration.BENCHMARK = true;
- }
- if (!combinedArguments.contains("SQL") && !combinedArguments.contains("HIKARI_SQL")) { // no if needed
- ServerConfiguration.MOCK_SQL = true;
- }
- }
- if (FileUtility.fileExists("dedicated_server.txt")) { // no if needed
- ServerConfiguration.FORCE_DEDICATED_SERVER = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement