Creating A Config - drupijs/Drupi-JS GitHub Wiki
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
0 CNF / PROPERTIES
1 JSON
2 YAML
5 ENUM / ENUMERATION
IMPORTANT
You can only choose config type on bedrock edition! Java edition will automaticly be YAML
//Specifying our config file
var configFile = manager.getFile("testFolder", "testFile.yml");
//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(config.exists("prefix")){
//Saves our config prefix as a variable
var prefix = cast.asString(config.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();
}