Skip to content

Commit

Permalink
boop
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG committed Oct 21, 2023
1 parent a5ea72d commit d0faaa0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin/src/main/java/com/iridium/iridiumcore/Persist.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -186,9 +187,9 @@ public <T> T load(Class<T> 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(
Expand Down

0 comments on commit d0faaa0

Please sign in to comment.