Added backup function; if file already exists when saving, renames to .bak
This commit is contained in:
@@ -127,6 +127,9 @@ public class VaultManager {
|
||||
*/
|
||||
public void saveFile(String name, YamlConfiguration yaml) throws IOException {
|
||||
File file = new File(directory + File.separator + name.toLowerCase() + ".yml");
|
||||
if (file.exists()) {
|
||||
file.renameTo(new File(directory + File.separator + name.toLowerCase() + ".yml.bak"));
|
||||
}
|
||||
yaml.save(file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user