HomeJavaModsSimpleJSONConfig – Smart JSON/YAML Configs & Data Stores for Bukkit/Spigot/Paper
SimpleJSONConfig – Smart JSON/YAML Configs & Data Stores for Bukkit/Spigot/Paper
ModsJava

SimpleJSONConfig – Smart JSON/YAML Configs & Data Stores for Bukkit/Spigot/Paper

SimpleJSONConfig Smart JSON/YAML configuration & data storage library for your Bukkit/Spigot/Paper plugins Create, manage and share configs with zero…

⬇ Download on Spigot
SimpleJSONConfig
Smart JSON/YAML configuration & data storage library for your Bukkit/Spigot/Paper plugins
Create, manage and share configs with zero boilerplate!

[​IMG]

✨ Main Features

Quick Start

1. Register SimpleJSONConfig in your plugin
Code (Java):

public class Main extends JavaPlugin {

    @Override
    public void onEnable ( ) {
        // Default directory: YourPlugin/configuration/
        SimpleJSONConfig. INSTANCE. register ( this ) ;
       
        // Use YAML instead of JSON
        SimpleJSONConfig. INSTANCE. register ( this, StoreType. YAML ) ;
       
        // Specify custom directory
        SimpleJSONConfig. INSTANCE. register ( this, new File ( "default/config/directory" ) ) ;
    }
}
 
2. Create your config class
Code (Java):

@Getter
@Configuration ( "config" ) // or config.json / path/to/config
@SuppressWarnings ( "FieldMayBeFinal" ) // no final modifiers yet
public class MyConfig extends Config {

    private String joinMessage = "Default join message" ;

    private List <ItemStack > startingEquipment = new ArrayList <> (
        Collections. singletonList ( new ItemStack (Material. DIRT ) )
    ) ;

    @Comment ( "This comment will appear in the config file too" )
    private YourType something ;
}
 
3. Access your config
Code (Java):

// Option 1: Get directly
private MyConfig config = Config. getConfig (MyConfig. class ) ;

// Option 2: Autowire into static field
@Autowired
private static MyConfig config ;
 
Data Stores
Persist any object that implements Identifiable with just an annotation!

Code (Java):

@Stored (value = "directory", storeType = StoreType. JSON )
public class MyClass implements Identifiable <UUID > {

    private final UUID id ;
    private int count ;

    @Override
    public UUID getId ( ) {
        return id ;
    }
}
 
Access it through a Service:
Code (Java):

private static Service <UUID, MyClass > service = Service. getService (MyClass. class ) ;

public void foo ( ) {
    MyClass obj = new MyClass (UUID. randomUUID ( ) ) ;
    service. save (obj ) ; // serialize to file
    MyClass loaded = service. getById (obj. getId ( ) ) ;
    List <MyClass > matching = service. getMatching (c -> c. getCount ( ) > 10 ) ;
    service. delete (obj ) ;
}
 
⚙️ Additional Features

Maven & Gradle
Spoiler: Maven
Code (XML):

<repositories>
    <repository>
        <id>jitpack.io </id>
        <url>https://jitpack.io </url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.2DevsStudio </groupId>
        <artifactId>SimpleJSONConfig </artifactId>
        <version>1.4.1 </version>
        <scope>compile </scope>
        <!-- Or provided if you want cross-plugin config sharing -->
    </dependency>
</dependencies>
 

Spoiler: Gradle
Code (gradle (Unknown Language)):

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.2DevsStudio:SimpleJSONConfig:1.4.1'
    // or compileOnly for cross-plugin config sharing
}
 

Why use SimpleJSONConfig?
Because writing config handling by hand is boring.
With SimpleJSONConfig you can:


Get it now on GitHub!
➡ GitHub Repository ⬅

Make your plugin development faster, cleaner, and more enjoyable with SimpleJSONConfig!
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

SimpleJSONConfig – Smart JSON/YAML Configs & Data Stores for Bukkit/Spigot/Paper is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 297 times (via Spigot). Download it and open it directly in the game.

Explore more