Class ConfigBuilder

java.lang.Object
net.ixdarklord.coolcatcore.api.config.ConfigBuilder

public final class ConfigBuilder extends Object
Declares a config: its settings, then its groups and values, then build() registers and loads it.

Values are added to the current group; push(String, String...) opens a nested group and pop() closes it, or group(String, Consumer) does both around a block. Each value starts with a typed method (bool(String, boolean), intValue(String, int), list(String, ConfigType, List)...), takes options, and ends with build(), which returns its handle:

ConfigBuilder builder = Config.builder("mymod", ConfigScope.SERVER);
ConfigValue<Integer> maxHomes = builder.intValue("maxHomes", 3).range(0, 64).comment("Homes per player.").build();
builder.push("webhook");
ConfigValue<String> url = builder.string("url", "").serverOnly().build();
builder.pop();
Config config = builder.build();