Skip to content

Nichtmetall/Spigot-Config-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spigot-Config-Manager

  1. [Install](#Install Package)
  2. [Install](#Install Package)
  3. [Example Config](#Example Config)

Install

Add code below to your pom.xml file

<dependency>
  <groupId>de.nichti</groupId>
  <artifactId>spigotconfigmanager</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Than run the command below via your command line

nvm install

First Steps

Create a new class and extend ConfigManager. As example ExampleConfig.java

public class ExampleConfig extends ConfigManager {
    public ExampleConfig(String pluginName) {
        super(pluginName);
    }
}

Then you can create a new Instance of your created class. I would recommend to make it static.

public static ExampleConfig config = new ExampleConfig("pluginName");

Example Config

import de.nichti.spigotconfigmanager.ConfigManager;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

public class ExampleConfig extends ConfigManager {
    public ExampleConfig(String pluginName) {
        super(pluginName);
        defaultConfig();
    }


    private void defaultConfig(){
        FileConfiguration config = new YamlConfiguration();
        config.set("Test1", "Test");
        config.set("Test2", 1);
        config.set("Test3", 1.5);

        registerDefaultConfig(config); //register new defaultConfig
        if(saveDefaultConfig()){
            //do stuff
        }
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages