···11+package com.jagex.runescape.config;
22+import org.yaml.snakeyaml.Yaml;
33+44+import java.io.File;
55+import java.io.FileInputStream;
66+import java.math.BigInteger;
77+import java.util.Map;
88+99+public class Configuration {
1010+1111+ public static void read() {
1212+ try {
1313+ final Yaml yaml = new Yaml();
1414+ final FileInputStream inputStream = new FileInputStream(new File("./config/client-config.yaml"));
1515+ final Map<String, Object> obj = yaml.load(inputStream);
1616+1717+ final Map<String, Object> net = (Map<String, Object>) obj.get("net");
1818+ final Map<String, Object> cache = (Map<String, Object>) obj.get("cache");
1919+ final Map<String, Object> rsa = (Map<String, Object>) obj.get("rsa");
2020+ final Map<String, Object> login = (Map<String, Object>) obj.get("login");
2121+ final Map<String, Object> game = (Map<String, Object>) obj.get("game");
2222+2323+ SERVER_ADDRESS = (String) net.get("address");
2424+ GAME_PORT = (int) net.get("game_port");
2525+ JAGGRAB_PORT = (int) net.get("jaggrab_port");
2626+ ONDEMAND_PORT = (int) net.get("ondemand_port");
2727+ HTTP_PORT = (int) net.get("http_port");
2828+ CACHE_NAME = (String) cache.get("cacheDir");
2929+ JAGGRAB_ENABLED = (boolean) cache.get("jaggrabEnabled");
3030+ RSA_PUBLIC_KEY = new BigInteger(String.valueOf((int) rsa.get("rsaPub")));
3131+ RSA_MODULUS = (BigInteger) rsa.get("rsaModulus");
3232+ USE_STATIC_DETAILS = (boolean) login.get("useStaticCredentials");
3333+ USERNAME = (String) login.get("username");
3434+ PASSWORD = (String) login.get("password");
3535+ ROOFS_ENABLED = (boolean) game.get("roofsEnabled");
3636+3737+ if(USERNAME == null) {
3838+ USERNAME = "";
3939+ }
4040+4141+ if(PASSWORD == null) {
4242+ PASSWORD = "";
4343+ }
4444+ } catch(Exception e) {
4545+ System.out.println("Unable to load client-config.yaml. Please use EXAMPLE-client-config.yaml to create one.");
4646+ }
4747+ }
4848+4949+ /**
5050+ * IP Address or Hostname of the server to establish a connection.
5151+ */
5252+ public static String SERVER_ADDRESS = "127.0.0.1";
5353+5454+ /**
5555+ * Name of the cache folder located in the users home directory.
5656+ */
5757+ public static String CACHE_NAME = ".377cache";
5858+5959+ /**
6060+ * Port for establishing a connection to the game server.
6161+ */
6262+ public static int GAME_PORT = 43594;
6363+6464+ /**
6565+ * Port for establishing a connection to the on demand service.
6666+ */
6767+ public static int ONDEMAND_PORT = 43594;
6868+6969+ /**
7070+ * Port for establishing a connection to the update server.
7171+ */
7272+ public static int JAGGRAB_PORT = 43595;
7373+7474+ /**
7575+ * Port for establishing a backup connection to the update
7676+ * server in case the initial JAGGRAB connection fails.
7777+ */
7878+ public static int HTTP_PORT = 80;
7979+8080+ /**
8181+ * Whether or not the update server should be used.
8282+ */
8383+ public static boolean JAGGRAB_ENABLED = false;
8484+8585+ /**
8686+ * Whether or not the network packets should be encrypted.
8787+ */
8888+ public static boolean RSA_ENABLED = true;
8989+9090+ /**
9191+ * Public key to be used in RSA network encryption.
9292+ */
9393+ public static BigInteger RSA_PUBLIC_KEY = new BigInteger("65537");
9494+9595+ /**
9696+ * Modulus to be used in the RSA network encryption.
9797+ */
9898+ public static BigInteger RSA_MODULUS = new BigInteger("170266381807335046121774073514220583891686029487165562794998484549236036467227923571770256617931840775621072487838687650522710227973331693237285456731778528244126984080232314114323601116304887478969296070648644633713088027922830600712492972687351204275625149978223159432963210789506993409208545916714905193639");
9999+100100+ /**
101101+ * Use static username/password pair.
102102+ */
103103+ public static boolean USE_STATIC_DETAILS = true;
104104+105105+ /**
106106+ * Static username and password
107107+ */
108108+109109+ public static String USERNAME = "Promises";
110110+ public static String PASSWORD = "Testing";
111111+112112+ /**
113113+ * Do you want to render roofs
114114+ */
115115+ public static boolean ROOFS_ENABLED = true;
116116+117117+}
···11-package tech.henning.client;
11+package com.jagex.runescape.config;
2233/**
44 * Created by Promises on 16/06/17.
-75
src/tech/henning/client/Configuration.java
···11-package tech.henning.client;
22-33-import java.math.BigInteger;
44-55-public class Configuration {
66-77- /**
88- * IP Address or Hostname of the server to establish a connection.
99- */
1010- public static final String SERVER_ADDRESS = "127.0.0.1";
1111-1212- /**
1313- * Name of the cache folder located in the users home directory.
1414- */
1515- public static final String CACHE_NAME = ".377cache";
1616-1717- /**
1818- * Port for establishing a connection to the game server.
1919- */
2020- public static final int GAME_PORT = 43594;
2121-2222- /**
2323- * Port for establishing a connection to the on demand service.
2424- */
2525- public static final int ONDEMAND_PORT = 43594;
2626-2727- /**
2828- * Port for establishing a connection to the update server.
2929- */
3030- public static final int JAGGRAB_PORT = 43595;
3131-3232- /**
3333- * Port for establishing a backup connection to the update
3434- * server in case the initial JAGGRAB connection fails.
3535- */
3636- public static final int HTTP_PORT = 80;
3737-3838- /**
3939- * Whether or not the update server should be used.
4040- */
4141- public static final boolean JAGGRAB_ENABLED = false;
4242-4343- /**
4444- * Whether or not the network packets should be encrypted.
4545- */
4646- public static final boolean RSA_ENABLED = true;
4747-4848- /**
4949- * Public key to be used in RSA network encryption.
5050- */
5151- public static final BigInteger RSA_PUBLIC_KEY = new BigInteger("65537");
5252-5353- /**
5454- * Modulus to be used in the RSA network encryption.
5555- */
5656- public static final BigInteger RSA_MODULUS = new BigInteger("170266381807335046121774073514220583891686029487165562794998484549236036467227923571770256617931840775621072487838687650522710227973331693237285456731778528244126984080232314114323601116304887478969296070648644633713088027922830600712492972687351204275625149978223159432963210789506993409208545916714905193639");
5757-5858- /**
5959- * Use static username/password pair.
6060- */
6161- public static final boolean USE_STATIC_DETAILS = true;
6262-6363- /**
6464- * Static username and password
6565- */
6666-6767- public static final String USERNAME = "Promises";
6868- public static final String PASSWORD = "Testing";
6969-7070- /**
7171- * Do you want to render roofs
7272- */
7373- public static final boolean ROOFS_ENABLED = true;
7474-7575-}