Jump to content

Question

Posted

New Config File:

• Ok, You should know how to add new config option to .properties files etc. So now I'll show how to create new .properties file. For example: matim.properties


- Ok, firstly lets create new .properties called matim.java (this is sample) in java/configfolder.

- Now open Config.java file. Ok firstly lets register Our new config file, find these lines:

Code:

//--------------------------------------------------
// L2J Property File Definitions
//--------------------------------------------------
public static final String CHARACTER_CONFIG_FILE = "./config/Character.properties";
public static final String EXTENSIONS_CONFIG_FILE = "./config/extensions.properties";
public static final String FEATURE_CONFIG_FILE = "./config/Feature.properties";
public static final String FORTSIEGE_CONFIGURATION_FILE = "./config/fortsiege.properties";
public static final String GENERAL_CONFIG_FILE = "./config/General.properties";
public static final String HEXID_FILE = "./config/hexid.txt";
public static final String ID_CONFIG_FILE = "./config/idfactory.properties";
public static final String SERVER_VERSION_FILE = "./config/l2j-version.properties";
public static final String DATAPACK_VERSION_FILE = "./config/l2jdp-version.properties";
public static final String L2JMOD_CONFIG_FILE = "./config/l2jmods.properties";
public static final String LOGIN_CONFIGURATION_FILE = "./config/loginserver.properties";
public static final String NPC_CONFIG_FILE = "./config/NPC.properties";
public static final String PVP_CONFIG_FILE = "./config/pvp.properties";
public static final String RATES_CONFIG_FILE = "./config/rates.properties";
public static final String CONFIGURATION_FILE = "./config/server.properties";
public static final String SIEGE_CONFIGURATION_FILE = "./config/siege.properties";
public static final String TELNET_FILE = "./config/telnet.properties";
public static final String FLOOD_PROTECTOR_FILE = "./config/floodprotector.properties";
public static final String MMO_CONFIG_FILE = "./config/mmo.properties";


- And lets add Our:

Quote
public static final String MATIM_CONFIG_FILE = "./config/matim.properties";

- Ok, Our config file is already registered now. Now we should add few things into class witch initializes all global variables for configuration.

- Find these lines:

Code:

			}
			catch (Exception e)
			{
				e.printStackTrace();
				throw new Error("Failed to Load "+L2JMOD_CONFIG_FILE+" File.");
			}


- And under them paste this:

Quote
            // Load PvP Properties file (if exists)
            try
            {
               Properties matimSettings = new Properties();
               is = new FileInputStream(new File(MATIM_CONFIG_FILE));
               matimSettings.load(is);

                               /** Here You can put Your configs (look at "Your Own Config") This is sample:

                                ALLOW_CREATE_LVL = Boolean.parseBoolean(matimSettings.getProperty("CostumStartLvl", "False"));

                                   */
                              

            }
            catch (Exception e)
            {
               e.printStackTrace();
               throw new Error("Failed to Load " + MATIM_CONFIGURATION_FILE + " File.");
            }

• Done, now Your custom Config file is created! But lines marked in green are just as sample!

ta xw akolouthisei , ta ksana vlepw kai ta ksana vlepw ala telos panton paw sto config dimiourgo ena new,

paw sto config.java

vazw to line:

ALLOWALLHERO = Boolean.valueOf(zeusSettings.getProperty("blablalblabla","bblalabla));

 

ala sto zeusSettings mou lei cannot be resolved :S

1 answer to this question

Recommended Posts

  • 0
Posted

File mou lipw  to config  ginete etsi

 

public static final String ZEUS = "./config/Custom/Zeus.properties";

 


 

+                                }
+                                
+                                try
+                                {
+                                        L2Properties ZeusSettings = new L2Properties();
+                                        is = new FileInputStream(new File(Zeus));
+                                        ZeusSettings.load(is);
+                                        
+                              ALLOWALLHERO = Boolean.valueOf(zeusSettings.getProperty("blablalblabla","bblalabla));
+                                        
+                                }
+                                catch(Exception e)
+                                {
+                                        e.printStackTrace();
+                                        throw new Error("Failed to Load "+ZEUS+" File.");

 


 

ama to dokimaseis tha einai ok :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..