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 .
Example Code
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:
<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.
- Twitter: @Creatorfromhell
- Discord: Here
Team
- creatorfromhell
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 .
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta