|
@@ -27,94 +27,94 @@ import java.util.logging.Logger;
|
|
|
public final class Config
|
|
|
{
|
|
|
protected static final Logger _log = Logger.getLogger(Config.class.getName());
|
|
|
-
|
|
|
- /** Properties file for community server configurations */
|
|
|
- public static final String CONFIGURATION_FILE = "./config/communityserver.properties";
|
|
|
- /** Properties file for server function configurations */
|
|
|
- public static final String GENERAL_FILE = "./config/General.properties";
|
|
|
|
|
|
- /** ************************************************** **/
|
|
|
+ /** Properties file for community server configurations */
|
|
|
+ public static final String CONFIGURATION_FILE = "./config/communityserver.properties";
|
|
|
+ /** Properties file for server function configurations */
|
|
|
+ public static final String GENERAL_FILE = "./config/General.properties";
|
|
|
+
|
|
|
+ /** ************************************************** **/
|
|
|
/** Server Settings -Begin **/
|
|
|
/** ************************************************** **/
|
|
|
- /** Driver to access to database */
|
|
|
- public static String DATABASE_DRIVER;
|
|
|
- /** Path to access to database */
|
|
|
- public static String DATABASE_URL;
|
|
|
- /** Database login */
|
|
|
- public static String DATABASE_LOGIN;
|
|
|
- /** Database password */
|
|
|
- public static String DATABASE_PASSWORD;
|
|
|
- /** Maximum number of connections to the database */
|
|
|
- public static int DATABASE_MAX_CONNECTIONS;
|
|
|
- /** Datapack root directory */
|
|
|
- public static File DATAPACK_ROOT;
|
|
|
- /** Accept alternate ID for server ? */
|
|
|
- public static boolean ACCEPT_ALTERNATE_ID;
|
|
|
- /** ID for request to the server */
|
|
|
- public static int REQUEST_ID;
|
|
|
-
|
|
|
- /** ************************************************** **/
|
|
|
+ /** Driver to access to database */
|
|
|
+ public static String DATABASE_DRIVER;
|
|
|
+ /** Path to access to database */
|
|
|
+ public static String DATABASE_URL;
|
|
|
+ /** Database login */
|
|
|
+ public static String DATABASE_LOGIN;
|
|
|
+ /** Database password */
|
|
|
+ public static String DATABASE_PASSWORD;
|
|
|
+ /** Maximum number of connections to the database */
|
|
|
+ public static int DATABASE_MAX_CONNECTIONS;
|
|
|
+ /** Datapack root directory */
|
|
|
+ public static File DATAPACK_ROOT;
|
|
|
+ /** Accept alternate ID for server ? */
|
|
|
+ public static boolean ACCEPT_ALTERNATE_ID;
|
|
|
+ /** ID for request to the server */
|
|
|
+ public static int REQUEST_ID;
|
|
|
+
|
|
|
+ /** ************************************************** **/
|
|
|
/** Server Settings -End **/
|
|
|
/** ************************************************** **/
|
|
|
|
|
|
- /** Game Server login port */
|
|
|
- public static int GAME_SERVER_LOGIN_PORT;
|
|
|
- /** Game Server login Host */
|
|
|
- public static String GAME_SERVER_LOGIN_HOST;
|
|
|
-
|
|
|
- /** Accept new game server ? */
|
|
|
- public static boolean ACCEPT_NEW_GAMESERVER;
|
|
|
-
|
|
|
- public static boolean FLOOD_PROTECTION;
|
|
|
- public static int FAST_CONNECTION_LIMIT;
|
|
|
- public static int NORMAL_CONNECTION_TIME;
|
|
|
- public static int FAST_CONNECTION_TIME;
|
|
|
- public static int MAX_CONNECTION_PER_IP;
|
|
|
-
|
|
|
- /** General settings */
|
|
|
- public static int MIN_PLAYER_LVL_FOR_FORUM;
|
|
|
- public static int MIN_CLAN_LVL_FOR_FORUM;
|
|
|
- public static long MAIL_AUTO_DELETION_TIME;
|
|
|
-
|
|
|
- public static int GENERAL_THREAD_CORE_SIZE;
|
|
|
-
|
|
|
- public static final void load()
|
|
|
- {
|
|
|
- try
|
|
|
+ /** Game Server login port */
|
|
|
+ public static int GAME_SERVER_LOGIN_PORT;
|
|
|
+ /** Game Server login Host */
|
|
|
+ public static String GAME_SERVER_LOGIN_HOST;
|
|
|
+
|
|
|
+ /** Accept new game server ? */
|
|
|
+ public static boolean ACCEPT_NEW_GAMESERVER;
|
|
|
+
|
|
|
+ public static boolean FLOOD_PROTECTION;
|
|
|
+ public static int FAST_CONNECTION_LIMIT;
|
|
|
+ public static int NORMAL_CONNECTION_TIME;
|
|
|
+ public static int FAST_CONNECTION_TIME;
|
|
|
+ public static int MAX_CONNECTION_PER_IP;
|
|
|
+
|
|
|
+ /** General settings */
|
|
|
+ public static int MIN_PLAYER_LVL_FOR_FORUM;
|
|
|
+ public static int MIN_CLAN_LVL_FOR_FORUM;
|
|
|
+ public static long MAIL_AUTO_DELETION_TIME;
|
|
|
+
|
|
|
+ public static int GENERAL_THREAD_CORE_SIZE;
|
|
|
+
|
|
|
+ public static final void load()
|
|
|
+ {
|
|
|
+ try
|
|
|
{
|
|
|
Properties serverSettings = new Properties();
|
|
|
InputStream is = new FileInputStream(new File(CONFIGURATION_FILE));
|
|
|
- serverSettings.load(is);
|
|
|
- is.close();
|
|
|
-
|
|
|
- GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("CSHostname","*");
|
|
|
- GAME_SERVER_LOGIN_PORT = Integer.parseInt(serverSettings.getProperty("CSPort","9013"));
|
|
|
-
|
|
|
- ACCEPT_NEW_GAMESERVER = Boolean.parseBoolean(serverSettings.getProperty("AcceptNewGameServer", "True"));
|
|
|
- REQUEST_ID = Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
|
|
|
- ACCEPT_ALTERNATE_ID = Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));
|
|
|
- DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
|
|
|
-
|
|
|
- DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
|
|
|
- DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jcb");
|
|
|
- DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
|
|
|
- DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
|
|
|
- DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
|
|
|
-
|
|
|
- Properties generalSettings = new Properties();
|
|
|
+ serverSettings.load(is);
|
|
|
+ is.close();
|
|
|
+
|
|
|
+ GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("CSHostname","*");
|
|
|
+ GAME_SERVER_LOGIN_PORT = Integer.parseInt(serverSettings.getProperty("CSPort","9013"));
|
|
|
+
|
|
|
+ ACCEPT_NEW_GAMESERVER = Boolean.parseBoolean(serverSettings.getProperty("AcceptNewGameServer", "True"));
|
|
|
+ REQUEST_ID = Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
|
|
|
+ ACCEPT_ALTERNATE_ID = Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));
|
|
|
+ DATAPACK_ROOT = new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
|
|
|
+
|
|
|
+ DATABASE_DRIVER = serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
|
|
|
+ DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jcb");
|
|
|
+ DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
|
|
|
+ DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
|
|
|
+ DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
|
|
|
+ GENERAL_THREAD_CORE_SIZE = Integer.parseInt(serverSettings.getProperty("ThreadPoolSize", "1"));
|
|
|
+
|
|
|
+ Properties generalSettings = new Properties();
|
|
|
is = new FileInputStream(new File(GENERAL_FILE));
|
|
|
- generalSettings.load(is);
|
|
|
- is.close();
|
|
|
-
|
|
|
- MIN_PLAYER_LVL_FOR_FORUM = Integer.parseInt(generalSettings.getProperty("MinPlayerLvLForForum", "1"));
|
|
|
- MIN_CLAN_LVL_FOR_FORUM = Integer.parseInt(generalSettings.getProperty("MinClanLvLForForum", "2"));
|
|
|
- MAIL_AUTO_DELETION_TIME = Long.parseLong(generalSettings.getProperty("MailAutoDeletionTime", "90")) * 86400000;
|
|
|
-
|
|
|
- GENERAL_THREAD_CORE_SIZE = Integer.parseInt(generalSettings.getProperty("ThreadPoolSize", "1"));
|
|
|
+ generalSettings.load(is);
|
|
|
+ is.close();
|
|
|
+
|
|
|
+ MIN_PLAYER_LVL_FOR_FORUM = Integer.parseInt(generalSettings.getProperty("MinPlayerLvLForForum", "1"));
|
|
|
+ MIN_CLAN_LVL_FOR_FORUM = Integer.parseInt(generalSettings.getProperty("MinClanLvLForForum", "2"));
|
|
|
+ MAIL_AUTO_DELETION_TIME = Long.parseLong(generalSettings.getProperty("MailAutoDeletionTime", "90")) * 86400000;
|
|
|
+
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|