-
Notifications
You must be signed in to change notification settings - Fork 4
Creating A Config
Alexander edited this page Mar 13, 2019
·
11 revisions
Here we create a simple config that checks if it contains a prefix and then loads it, else it creates one.
Config types:
- -1. DETECT
-
- CNF / PROPERTIES
-
- JSON
-
- YAML
-
- ENUM / ENUMERATION
//Specifying our config file
var configFile = manager.getFile("testFile.yml", "testFolder");
//Selecting a config type
var configType = 2;
//Loading our config
var config = manager.createConfig(configFile, configType);
//Here we check if our config includes a prefix
if(conf.exists("prefix"){
//Saves our config prefix as a variable
var prefix = cast.asString(conf.get("prefix"));
//...
} else {
//Our config does not contain a prefix, so we set one.
config.set("prefix", "TestConfigPrefix");
//Saving our config, with our edited one.
config.save();
}