Skip to content

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
    1. CNF / PROPERTIES
    1. JSON
    1. YAML
    1. 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();

}

Clone this wiki locally