I am setting up a .jar file loader, and I want to modify a .yml File in the .jar File before I use it in a method like this. Bukkit().getPluginManager().loadPlugin(File file);
If i understand it correctly, i have also have to save the changes.
I don't have the knowledge of how to do this, because I have never used files in a way like this before in Java 8. If there is somebody out, I would be very happy
Here the method where I load the jar Files, and then the place, where I want to modify and save it
for (final File file : folder.listFiles()) {// Get all files in the folder
if (!file.isDirectory()) {// Only use the file, if it is a regular file
try {
if (FileManager.isJarFile(file)) {
// found a jar file
System.out.println("Found jarfile with possible yml.file in it: " + file.getName());
/*
*
* Here it should modify the .jar file like above, bevore it gets loaded
*
*/
}
} catch (IOException e) {
// Didn't found that jar file, can ignore it
}
}
}
Short: So what should the method do? It should load the jar file, load a .yml file in it, modify the file, and then save the changes in the .jar file again.