I don’t use many of those configuration options for precisely that reason; I find I’m able to do what I need to easier on my own and it ends up clearer as well. Here’s how you’d go about setting up an asset:
PluginContainer container; //Should be stored in your @Plugin class
Path directory; //Easiest to inject this with @ConfigDir
Path path = directory.resolve("config.conf");
if (Files.notExists(path)) {
Asset asset = container.getAsset("default-config.conf").get();
asset.copyToFile(path); //this *creates* the file as well
}
//from there, normal configuration stuff
HoconConfigurationLoader loader = HoconConfigurationLoader.builder()
.setPath(path)
.build();
CommentedConfigurationNode root = loader.load();
Alternatively, you can also just get the asset and then copy it only if the actual config file isn’t present. There is a performance difference between the two, but the readability might be worth it to you (and during startup it’s not as important anyways).
container.getAsset("default-config.conf").get().copyToFile(path, false, true);
// override is false, onlyIfAbsent is true
Basically, all this is doing is creating your config file with a preset you’ve created that’s stored in the jar file. There’s no trickery or anything special going on with it; just a file copy.