Home›Java›Mods›The New Config Library
ModsJava

The New Config Library

Java mod listed for Minecraft 1.7–1.13. Download on the author's site.

⬇ Download on Spigot
About
The New Config Library is a library that allows you to create commented configurations with ease. We utilize a custom YAML Parser that allows for specialized features that are not supported by the YAML specification, such as maintaining comments, comment modification, and automatic tab to space conversion.

How To Use
In order to use this library, you must first download the library and add it as a dependency to your project. After that please use the example code below on how to use it, or if you'd like to visually learn, check out the source code to the project here .

Spoiler: Example Code
Code (Java):
package test.config ;

import net.tnemc.config.CommentedConfiguration ;

import java.io.File ;
import java.nio.file.Paths ;
import java.util.LinkedList ;

/**
* Created by creatorfromhell.
*
* The New Config Library Minecraft Server Plugin
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
* International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/
* or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/

public class MainTest {

  public static void main ( String [ ] args ) {
    final File defaults = Paths. get ( "C: \\ Users \\ Daniel \\ Desktop \\ Minecraft \\ spigot2 \\ plugins \\ TheNewEconomy \\ config.yml" ) . toFile ( ) ;
    final File file = Paths. get ( "C: \\ Users \\ Daniel \\ Desktop \\ Minecraft \\ spigot2 \\ plugins \\ TheNewEconomy \\ newconfig.yml" ) . toFile ( ) ;

    //We defined a new CommentedConfiguration instance with our file, and a file of our default configurations.
    CommentedConfiguration config = new CommentedConfiguration ( file, defaults ) ;

    //We now load our configurations.
    config. load ( ) ;

    //Simple Contains call that should return false.
    System . out . println ( config. contains ( "Core.Server.Blah" ) ) ;

    //Simple Contains call that should return true.
    System . out . println ( config. contains ( "Core.Server.Name" ) ) ;

    //Simple value retrieval
    System . out . println ( config. getString ( "Core.Server.Name" ) ) ;

    //Simple boolean retrieval
    System . out . println ( config. getBool ( "Core.UUID" ) ) ;


    //Simple value setting.
    LinkedList < String > values = new LinkedList <> ( ) ;
    values. add ( "true" ) ;
    config. getNode ( "Core.UUID" ) . setValues ( values ) ;

    //We now Save our configuration.
    config. save ( ) ;

    //Simple call to get keys.
    System . out . println ( config. getSection ( "Core.Server" ) . getKeys ( false ) ) ;
  }
}

MAVEN
The New Config Library also supports maven. In order to use it with your maven project use the following information:
Code (YAML):


    <repositories >
       <repository >
           <id>tne-repo</id >
           <url>https://dl.bintray.com/theneweconomy/java/</url >
       </repository >
   </repositories >

    <dependencies >
       <dependency >
           <groupId>net.tnemc</groupId >
           <artifactId>TheNewConfigLibrary</artifactId >
           <version>0.1.0.0</version >
       </dependency >
   </dependencies>


Known Caveats
This is a list of known caveats:

Support
For support choose one of the following.

Team

Contribute
To contribute to The New Economy you may fork our Github Repository, and make a Pull Request. The repository is located at: https://github.com/TheNewEconomy/TheNewConfigLibrary .
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.

The New Config Library is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 265 times (via Spigot). Download it and open it directly in the game.

Explore more