Skip to content

binaryoverload/JSON-Config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON-Config

Build Status JitPack Version documenation

Add as a dependency

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'
}

Example

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"
  }
}