Merge The File&Game Servers Into One Module (#519)

* Merge The File&Game Servers Into One Module

* Make SettingsLoader A GameConstants ConfigLoader
If A Config File Isn't Used, The Server Will Fall Back To The Defaults Set In GameConstants.java

Config Files Can Be Loaded With The "-c/-config configfilelocation.json"
Added A Default Prefilled ServerConfig.json

* Update ConfigLoader

* Bring Back Independant "Secrets" Loader For External Password Stuff
* Added A Bunch More Vars To The ConfigLoader
* Included A Sample "Server Config"
* Also Updated README.md As Parabot Is No Longer Maintained & We No Longer Have A FileServer Module

* Bundle FileServer with Server (docker)

* Remove /udp and http port

* Update .gitignore

* Move FileServer from `org.apollo.jagcached` → `org/apollo/jagcached`

* Tidy GameConstants & Add More Vars To ConfigLoader

* Organised Up GameConstants A Little To Separate ConfigLoader Vars From The Rest
* Added Some More Variables To Be Loaded Through The ConfigLoader

* Fix A Derp Caused By Laziness

* Add -c/-config arg to README.md

* Enable FileServer By Default

Co-authored-by: Danial <admin@redsparr0w.com>
This commit is contained in:
Josh Shippam
2021-11-23 00:29:25 +00:00
committed by GitHub
parent ba7f84fc45
commit 1c5b400f00
59 changed files with 213 additions and 236 deletions
@@ -35,7 +35,6 @@ import com.rs2.game.players.PlayerSave;
import com.rs2.game.shops.ShopHandler;
import com.rs2.integrations.PlayersOnlineWebsite;
import com.rs2.integrations.RegisteredAccsWebsite;
import com.rs2.integrations.SettingsLoader;
import com.rs2.integrations.discord.DiscordActivity;
import com.rs2.integrations.discord.JavaCord;
import com.rs2.net.ConnectionHandler;
@@ -49,6 +48,7 @@ import com.rs2.world.ObjectHandler;
import com.rs2.world.ObjectManager;
import com.rs2.world.clip.ObjectDefinition;
import com.rs2.world.clip.RegionFactory;
import org.apollo.jagcached.FileServer;
/**
* Server.java
@@ -141,6 +141,24 @@ public class GameEngine {
public static void main(java.lang.String[] args)
throws NullPointerException, IOException {
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-") && (i + 1) < args.length && !args[i + 1].startsWith("-")) {
switch(args[i]) {
case "-c":
case "-config":
try {
//TODO Load A Default Config File When Arg Not Used
System.out.println("Loading External Config..");
ConfigLoader.loadSettings(args[++i]);
System.out.println("Loaded Config File " + args[i]);
} catch (IOException e) {
System.out.println("Config File Not Found");
}
break;
}
}
}
System.out.println("Starting game engine..");
if (GameConstants.SERVER_DEBUG) {
System.out.println("@@@@ DEBUG MODE IS ENABLED @@@@");
@@ -163,12 +181,24 @@ public class GameEngine {
/**
* Starting Up Server
*/
System.out.println("Launching " + GameConstants.SERVER_NAME + "...");
System.out.println("Launching " + GameConstants.SERVER_NAME + " World: " + GameConstants.WORLD + "...");
/**
* Starts The File Server If Enabled In GameConstants
*/
if(GameConstants.FILE_SERVER) {
FileServer fs = new FileServer();
try {
fs.start();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Start Integration Services
**/
SettingsLoader.loadSettings();
ConfigLoader.loadSecrets();
JavaCord.init();
/**