Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

VertConfig (Json Config Api)

VertConfig strives to provide a clean and easy to use JSON config api.

Info

JavaDocs:https://javadocs.vertcode.eu/vertconfigs/

Discord: VertCode#0001

Download

Last Stable Version:1.0.1

Maven

<repository>
<id>vertcode</id>
<url>https://repo.wesleybreukers.nl/repository/vertcode/</url>
</repository>
<dependency>
<groupId>eu.vertcode</groupId>
<artifactId>vertconfig</artifactId>
<version>VERSION</version>
</dependency>

Gradle

dependencies {
compile 'eu.vertcode:vertconfig:VERSION'
}
repositories {
mavenCentral()
maven {
name 'vertcode'
url 'https://repo.wesleybreukers.nl/repository/vertcode/'
}
}

Usage

Example Class

importeu.vertcode.vertconfig.VertConfigs;
importeu.vertcode.vertconfig.object.VertConfig;
importjava.io.File;
importjava.io.IOException;
importjava.util.Arrays;
importjava.util.List;
publicclassExample {
publicstaticvoidmain(String[] args) throwsIOException {
VertConfigconfig = VertConfigs.getInstance().getConfig(newFile("config.json"),
Example.class.getClassLoader().getResourceAsStream("config.json"));
Stringexample1 = config.getString("example.1");
List<String> examples = config.getStringList("examples");
System.out.println("example1 = " + example1);
System.out.println("examples = " + String.join(", ", examples));
config.set("example.1", "Hello!");
config.set("examples", Arrays.asList("Example3", "Example4"));
config.save();
example1 = config.getString("example.1");
examples = config.getStringList("examples");
System.out.println("example1 = " + example1);
System.out.println("examples = " + String.join(", ", examples));
}
}

config.json in the resources folder

{
"example": {
"1": "Example1"
},
"examples": [
"Example1",
"Example2"
]
}

Output

example1 = "Example1"examples = Example1, Example2example1 = "Hello!"examples = Example3, Example4

About

A easy to use JSON config api.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages