aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2023-10-19 23:32:12 +0200
committerGitHub <noreply@github.com>2023-10-19 23:32:12 +0200
commit54e236158db9b5947d125f83b29e53cf27f73a79 (patch)
tree213b29b23bf294700cfb144e7878ed869e6acff8 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
parente0a2f5f5991048317f5c045feca084a1413c45fd (diff)
downloadnotenoughupdates-54e236158db9b5947d125f83b29e53cf27f73a79.tar.gz
notenoughupdates-54e236158db9b5947d125f83b29e53cf27f73a79.tar.bz2
notenoughupdates-54e236158db9b5947d125f83b29e53cf27f73a79.zip
Use atomic move for config + small cleanup (#881)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
index 97aa25d4..a1bf34a3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
@@ -26,6 +26,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
+import io.github.moulberry.notenoughupdates.core.config.ConfigUtil;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -42,14 +43,10 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -349,21 +346,7 @@ public class FairySouls {
}
public void saveFoundSoulsForAllProfiles(File file, Gson gson) {
- try {
- //noinspection ResultOfMethodCallIgnored
- file.createNewFile();
-
- try (
- BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(file),
- StandardCharsets.UTF_8
- ))
- ) {
- writer.write(gson.toJson(allProfilesFoundSouls));
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
+ ConfigUtil.saveConfig(allProfilesFoundSouls, file, gson);
}
public void tick() {