Skip to content

Fabricio20/SimpleConfig

Repository files navigation

SimpleConfig Build Status

SimpleConfig is a configuration library for SpigotMC that was made to help you develop your plugins quickly.

Check versions here: https://maven.notfab.net/Hosted/net/notfab/spigot/SimpleConfig/

Installation

Note: Standalone configuration requires SnakeYAML >= 1.23

Maven:

<repositories>
    <repository>
        <id>NotFab</id>
        <url>https://maven.notfab.net/Hosted</url>
    </repository>
</repositories>
<dependency>
    <groupId>net.notfab.spigot</groupId>
    <artifactId>SimpleConfig</artifactId>
    <version>1.4.1</version>
</dependency>

Gradle:

repositories {
    maven { url "https://maven.notfab.net/Hosted" }
}
compile group: 'net.notfab.spigot', name: 'SimpleConfig', version: '1.4.1'

Usage

Spigot/Bukkit:

public class Example extends JavaPlugin {
    
    private SimpleConfigManager simpleConfigManager;
    
    @Override
    public void onEnable() {
        simpleConfigManager = new SpigotConfigManager(this);
        // Load config file
        SimpleConfig config = simpleConfigManager.getNewConfig("config.yml");
        // get boolean
        boolean b = config.getBoolean("some.path");
        // get list of strings
        List<String> strs = config.getStringList("some.other.path");
        // set a value
        config.set("some.string", "hello there");
        // write to disk
        config.save();
        // reload from disk
        config.reload();
    }
    
}

BungeeCord:

public class Example extends Plugin {
    
    private SimpleConfigManager simpleConfigManager;
    
    @Override
    public void onEnable() {
        simpleConfigManager = new BungeeConfigManager(this);
        // Load config file
        SimpleConfig config = simpleConfigManager.getNewConfig("config.yml");
        // get boolean
        boolean b = config.getBoolean("some.path");
        // get list of strings
        List<String> strs = config.getStringList("some.other.path");
        // set a value
        config.set("some.string", "hello there");
        // write to disk
        config.save();
        // reload from disk
        config.reload();
    }
    
}

Standalone:

public class Example {
    
    private SimpleConfigManager simpleConfigManager;
    
    public Example() {
        simpleConfigManager = new StandaloneConfigManager(new File("config/"));
        // Load config file
        SimpleConfig config = simpleConfigManager.getNewConfig("config.yml");
        // get boolean
        boolean b = config.getBoolean("some.path");
        // get list of strings
        List<String> strs = config.getStringList("some.other.path");
        // set a value
        config.set("some.string", "hello there");
        // write to disk
        config.save();
        // reload from disk
        config.reload();
    }
    
}

Contributors

  • Fabricio20 [Maintainer]
  • Mister_2 [Retired]
  • Log-out [Original Author]

License

This project is licensed under the GNU General Public License v3.0, for more information, please check the LICENSE file.

About

SimpleConfig Library for SpigotMC/Bukkit

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages