Giter VIP home page Giter VIP logo

simpleconfig's Introduction

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.

simpleconfig's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar fabricio20 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.