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 :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...