All I want to do is correctly create a configuration file, and people, as well as the documentation, tells me to use asset manager, yet the documentation is so confusing and I can’t get anywhere. First, I assume I need to inject PluginContainer because plugin in plugin.getAsset doesn’t exist. I’m not even sure if I’m doing that correctly because the examples for injection are horribly confusing… this is the best I could figure out:
@Inject
private PluginContainer plugin;
After I do that, I can use plugin.getAsset. Now I cannot figure out if it wants me to do this first:
Asset asset = plugin.getAsset("myfile.txt").get();
or
if (Files.notExists(configPath)) {
plugin.getAsset("default.conf").copyToFile(configPath);
}
because it says Asset asset = plugin.getAsset(“myfile.txt”).get(); is if you have the file, which I don’t. It also says the second piece of code can create one if you use the PluginContainer and that code, yet it doesn’t explain properly how to use PluginContainer.
If it’s not clear, I haven’t programmed much Java, so if this is common sense, I apologize. Could somebody please give me a better explanation or at least a full example that isn’t cut into a billion pieces like the documentation. Thank you.
EDIT: I forgot to mention, on the second piece of code, I cannot use plugin.getAsset(“default.conf”).copyToFile(configPath); because it creates an error saying it needs a “=” like what it does with Asset Asset =.