Skip to content

Config Groups

Ang edited this page Nov 18, 2022 · 1 revision

What are they?

Config groups are a simple way to organize your options. They were introduced in v2.1.0.

How do I use them?

Below is an example of grouping multiple options together using a config group.

public static final ConfigOption<String> DISCORD_USERNAME = new ConfigOption<>("username", new String("acee#1220"));
public static final ConfigOption<String> ABOUT_ME = new ConfigOption<>("about_me", new String("Minecraft modder and game developer"));

public static final ConfigGroup MY_INFO = new ConfigGroup("my_info", DISCORD_USERNAME, ABOUT_ME);

Using this code with the JSON serializer gives you the following result:

{
  "my_info": {
    "username": "acee#1220",
    "about_me": "Minecraft modder and game developer"
  }
}

Config groups do also work in TOML, and YAML. I just used JSON as an example.

Paragon is a simple, easy-to-use and lightweight config library.

Clone this wiki locally