Various Changes (#614)
* Clean Old Log Files * Various Changes * Moved minutes.log to log folder * Made SERVER_LOG_DIR constant * Moved FILE_SYSTEM_DIR to GameConstants & Deleted org.apollo.jagcached.Constants * Removed unused minutes.log from data/data * Removed Duplicate RSAKeyGen * Moved RSAKeyGen from com.rs2.net.rsa to com.rs2.util.rsa * Removed data/net.xml & Created Moved NetworkConstants.java * Add HTTP & Jaggrab Port's to ConfigLoader * IntelliJ Reformat ConfigLoader.java * Fix Mistake * Attempt #2 * Woops, wrong port
This commit is contained in:
1 parent
88a9562e03
commit
55ca851d07
201 files changed
+1264
-12570
No files matched your search
@@ -12,62 +12,66 @@ import java.util.stream.Collectors;
|
||||
public class ConfigLoader {
|
||||
|
||||
public static void loadSettings(String config) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new FileReader(config));
|
||||
String out = br.lines().collect(Collectors.joining("\n"));
|
||||
JSONObject obj = new JSONObject(out);
|
||||
BufferedReader br = new BufferedReader(new FileReader(config));
|
||||
String out = br.lines().collect(Collectors.joining("\n"));
|
||||
JSONObject obj = new JSONObject(out);
|
||||
|
||||
if(obj.has("server_name"))
|
||||
GameConstants.SERVER_NAME = obj.getString("server_name");
|
||||
if(obj.has("server_test_version"))
|
||||
GameConstants.TEST_VERSION = obj.getDouble("server_test_version");
|
||||
if(obj.has("gui_enabled"))
|
||||
GameConstants.GUI_ENABLED = obj.getBoolean("gui_enabled");
|
||||
if(obj.has("website_link"))
|
||||
GameConstants.WEBSITE_LINK = obj.getString("website_link");
|
||||
if(obj.has("server_debug"))
|
||||
GameConstants.SERVER_DEBUG = obj.getBoolean("server_debug");
|
||||
if(obj.has("file_server"))
|
||||
GameConstants.FILE_SERVER = obj.getBoolean("file_server");
|
||||
if(obj.has("world_id"))
|
||||
GameConstants.WORLD = obj.getInt("world_id");
|
||||
if(obj.has("members_only"))
|
||||
GameConstants.MEMBERS_ONLY = obj.getBoolean("members_only");
|
||||
if(obj.has("tutorial_island_enabled"))
|
||||
GameConstants.TUTORIAL_ISLAND = obj.getBoolean("tutorial_island_enabled");
|
||||
if(obj.has("party_room_enabled"))
|
||||
GameConstants.PARTY_ROOM_DISABLED = !obj.getBoolean("party_room_enabled");
|
||||
if(obj.has("clues_enabled"))
|
||||
GameConstants.CLUES_ENABLED = obj.getBoolean("clues_enabled");
|
||||
if(obj.has("admin_can_trade"))
|
||||
GameConstants.ADMIN_CAN_TRADE = obj.getBoolean("admin_can_trade");
|
||||
if(obj.has("admin_can_drop_items"))
|
||||
GameConstants.ADMIN_DROP_ITEMS = obj.getBoolean("admin_can_drop_items");
|
||||
if(obj.has("admin_can_sell"))
|
||||
GameConstants.ADMIN_CAN_SELL_ITEMS = obj.getBoolean("admin_can_sell");
|
||||
if(obj.has("respawn_x"))
|
||||
GameConstants.RESPAWN_X = obj.getInt("respawn_x");
|
||||
if(obj.has("respawn_y"))
|
||||
GameConstants.RESPAWN_Y = obj.getInt("respawn_y");
|
||||
if(obj.has("save_timer"))
|
||||
GameConstants.SAVE_TIMER = obj.getInt("save_timer");
|
||||
if(obj.has("timeout"))
|
||||
GameConstants.TIMEOUT = obj.getInt("timeout");
|
||||
if(obj.has("item_requirements"))
|
||||
GameConstants.ITEM_REQUIREMENTS = obj.getBoolean("item_requirements");
|
||||
if(obj.has("variable_xp_rate"))
|
||||
GameConstants.VARIABLE_XP_RATE = obj.getBoolean("variable_xp_rate");
|
||||
if(obj.has("xp_rate"))
|
||||
GameConstants.XP_RATE = obj.getDouble("xp_rate");
|
||||
if(obj.has("max_players"))
|
||||
GameConstants.MAX_PLAYERS = obj.getInt("max_players");
|
||||
if (obj.has("variable_xp_rates")) {
|
||||
JSONArray rates = obj.optJSONArray("variable_xp_rates");
|
||||
for (int i = 0; i < rates.length(); ++i) {
|
||||
GameConstants.VARIABLE_XP_RATES[i] = rates.optInt(i);
|
||||
}
|
||||
if (obj.has("server_name"))
|
||||
Constants.SERVER_NAME = obj.getString("server_name");
|
||||
if (obj.has("server_test_version"))
|
||||
Constants.TEST_VERSION = obj.getDouble("server_test_version");
|
||||
if (obj.has("gui_enabled"))
|
||||
Constants.GUI_ENABLED = obj.getBoolean("gui_enabled");
|
||||
if (obj.has("website_link"))
|
||||
Constants.WEBSITE_LINK = obj.getString("website_link");
|
||||
if (obj.has("server_debug"))
|
||||
Constants.SERVER_DEBUG = obj.getBoolean("server_debug");
|
||||
if (obj.has("file_server"))
|
||||
Constants.FILE_SERVER = obj.getBoolean("file_server");
|
||||
if (obj.has("http_port"))
|
||||
Constants.HTTP_PORT = obj.getInt("http_port");
|
||||
if (obj.has("jaggrab_port"))
|
||||
Constants.JAGGRAB_PORT = obj.getInt("jaggrab_port");
|
||||
if (obj.has("world_id"))
|
||||
Constants.WORLD = obj.getInt("world_id");
|
||||
if (obj.has("members_only"))
|
||||
Constants.MEMBERS_ONLY = obj.getBoolean("members_only");
|
||||
if (obj.has("tutorial_island_enabled"))
|
||||
Constants.TUTORIAL_ISLAND = obj.getBoolean("tutorial_island_enabled");
|
||||
if (obj.has("party_room_enabled"))
|
||||
Constants.PARTY_ROOM_DISABLED = !obj.getBoolean("party_room_enabled");
|
||||
if (obj.has("clues_enabled"))
|
||||
Constants.CLUES_ENABLED = obj.getBoolean("clues_enabled");
|
||||
if (obj.has("admin_can_trade"))
|
||||
Constants.ADMIN_CAN_TRADE = obj.getBoolean("admin_can_trade");
|
||||
if (obj.has("admin_can_drop_items"))
|
||||
Constants.ADMIN_DROP_ITEMS = obj.getBoolean("admin_can_drop_items");
|
||||
if (obj.has("admin_can_sell"))
|
||||
Constants.ADMIN_CAN_SELL_ITEMS = obj.getBoolean("admin_can_sell");
|
||||
if (obj.has("respawn_x"))
|
||||
Constants.RESPAWN_X = obj.getInt("respawn_x");
|
||||
if (obj.has("respawn_y"))
|
||||
Constants.RESPAWN_Y = obj.getInt("respawn_y");
|
||||
if (obj.has("save_timer"))
|
||||
Constants.SAVE_TIMER = obj.getInt("save_timer");
|
||||
if (obj.has("timeout"))
|
||||
Constants.TIMEOUT = obj.getInt("timeout");
|
||||
if (obj.has("item_requirements"))
|
||||
Constants.ITEM_REQUIREMENTS = obj.getBoolean("item_requirements");
|
||||
if (obj.has("variable_xp_rate"))
|
||||
Constants.VARIABLE_XP_RATE = obj.getBoolean("variable_xp_rate");
|
||||
if (obj.has("xp_rate"))
|
||||
Constants.XP_RATE = obj.getDouble("xp_rate");
|
||||
if (obj.has("max_players"))
|
||||
Constants.MAX_PLAYERS = obj.getInt("max_players");
|
||||
if (obj.has("variable_xp_rates")) {
|
||||
JSONArray rates = obj.optJSONArray("variable_xp_rates");
|
||||
for (int i = 0; i < rates.length(); ++i) {
|
||||
Constants.VARIABLE_XP_RATES[i] = rates.optInt(i);
|
||||
}
|
||||
if(obj.has("website_integration"))
|
||||
GameConstants.WEBSITE_INTEGRATION = obj.getBoolean("website_integration");
|
||||
}
|
||||
if (obj.has("website_integration"))
|
||||
Constants.WEBSITE_INTEGRATION = obj.getBoolean("website_integration");
|
||||
}
|
||||
|
||||
private static void initialize() {
|
||||
@@ -99,12 +103,12 @@ public class ConfigLoader {
|
||||
/*
|
||||
* Sets External Services Vars
|
||||
*/
|
||||
if(obj.has("bot-token"))
|
||||
if (obj.has("bot-token"))
|
||||
JavaCord.token = obj.getString("bot-token");
|
||||
if(obj.has("websitepass"))
|
||||
if (obj.has("websitepass"))
|
||||
PlayersOnlineWebsite.password = obj.getString("websitepass");
|
||||
RegisteredAccsWebsite.password = obj.getString("websitepass");
|
||||
if(obj.has("erssecret"))
|
||||
RegisteredAccsWebsite.password = obj.getString("websitepass");
|
||||
if (obj.has("erssecret"))
|
||||
GameEngine.ersSecret = obj.getString("erssecret");
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user