class |
Section
A Section is a part of a config file.
It is basically just a path.
Example config.yml:
Simple Value 1: True
Simple Value 2: 20
Simple Value 3: 10.01
Simple Value 4: This is a simple string
Simple Value 5: "Quotes \" are required \'"
Short List 1: ["10", "Hey", "Yes"]
List 2:
- Yes
- 20
- 10.01
- This is a simple string
Section 1:
A value: 10
Subsection 1:
A value: 20
A list:
- 20
- 30
Section 2:
Subsection:
A value: true
Example Code:
Config config = Config.getNewConfig(getLogger(), new File(""), "config.yml");
ISection section1 = config.getSection("Section 1");
config.getKeys("section1", false);
//[Section1.A value, Section1.Subsection 1, Section1.A list]
section1.getKeys(false);
//[A value, Subsection 1, A list]
section1.getKeys(true);
//[A value, Subsection 1, Subsection 1.A value, A list]
//(Returned order can be different)
config.getString("Section1.A value");
//10
section1.getString("A value");
//10
section1.set("A list", new int[] {20, 30});
config.getIntegerList("Section1.A list");
//[20, 30]
config.getDoubleList("Section1.A list");
//[20.0, 30.0]
section1.getStringList("A list");
//["20", "30"]
section1.set("A list", new double[] {11.0, 12.9, 9.9999999});
section1.getIntegerList("A list");
//[11, 12, 9]
section1.getStringList("A list");
//["11.0", "12.9", "9.99999"] (rounded to 5 decimals)
|