diff --git a/plugin/src/main/java/com/iridium/iridiumcore/Persist.java b/plugin/src/main/java/com/iridium/iridiumcore/Persist.java index a3391ef4..b71729d7 100644 --- a/plugin/src/main/java/com/iridium/iridiumcore/Persist.java +++ b/plugin/src/main/java/com/iridium/iridiumcore/Persist.java @@ -12,6 +12,7 @@ import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.time.LocalDateTime; import java.util.Locale; /** @@ -186,9 +187,9 @@ public T load(Class clazz, File file) { javaPlugin.getLogger().severe("Failed to parse " + file + ": " + e.getMessage()); javaPlugin.getLogger().severe("Getting a backup for " + file + " into backups folder"); try { - file.renameTo(new File(javaPlugin.getDataFolder(), "broken_" + file.getName() + persistType.getExtension())); + file.renameTo(new File(javaPlugin.getDataFolder(), "broken_" + file.getName() + "_" + LocalDateTime.now() + persistType.getExtension())); File backupFolder = new File(javaPlugin.getDataFolder().getPath(), "backups"); - backupFolder.mkdirs(); + if (!backupFolder.exists()) backupFolder.mkdirs(); Files.move(file.toPath(), backupFolder.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException exception) { javaPlugin.getLogger().severe(