Created
June 11, 2015 23:54
-
-
Save varrix/3a9662ea210b580ef21d to your computer and use it in GitHub Desktop.
HoconFile example!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initConfig() { | |
// construct our HoconFile object usin | |
File folder = new File("config", "cortex"); | |
// Params: 1-Super folder of plugin, 2-file name, 3-logger instance | |
HoconFile config = new HoconFile(folder, "config", logger); | |
// Optionally can drop the 3rd param (only available for the verbose version) | |
// if using verbose version, you can toggle verbosity (great for debugging a single file- not recommended for use on ALL files) | |
config.setVerbose(true); | |
// creates the file with the boolean true which means it will attempt to merge defaults from a file with the same name | |
// existing within the JAR (calls HoconFile#mergeDefaults() which ONLY works if the resource exists) | |
config.create(true); | |
// simply load the configuration | |
config.load(); | |
// config.save(); to save (easy nuff!) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment