Skip to content

Configs

Mr Zombii edited this page Mar 26, 2024 · 4 revisions

Building Your Config

BasicConfig.Builder configBuilder BasicConfig.makeIfNotExists("anyConfigName");
configBuilder.addOption("testOption1", "Hello I'm A Config Value :)");

BasicConfig cfg = configBuilder.build();
cfg.getValue("testOption1", "Default Config Value :)");

To create a config you would call the BasicConfig.makeifNotExists method and supply it with the name of choice for your config.

To add options to the config file you do .addOption to your config builder to add a key and a value that can be any Number Type, String, Or Boolean.

To build your config and use it you can now call .build() and .getValue can be used to get your option you set in the config. With .getValue you need to pass the key for the option and the default value if getting the key fails.

Getting an Existing Config

BasicConfig cfg = BasicConfig.find("anyConfigName");
cfg.getValue("testOption1", "Default Config Value :)");

To get your existing config you can call BasicConfig.find and you can pass the name of your config like "TestConfig".

Clone this wiki locally