Maven:
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
...
<dependency>
<groupId>com.github.binaryoverload</groupId>
<artifactId>JSON-Config</artifactId>
<version>@VERSION@</version>
</dependency>
Gradle:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile group: 'com.github.binaryoverload', name: 'JSON-Config', version: 'VERSION'
}
public static void main(String[] args) {
JSONConfig config = new JSONConfig("config.json");
if (config.getString("bot.token") != null)
init(config.getString("bot.token"));
else {
throw new IllegalStateException("You need the token in order to start the bot!");
System.exit(1);
}
}
Example config:
{
"bot": {
"token": "Amazing.Bot.Token"
}
}