File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Fabric/src/main/java/betteradvancements/fabric/config Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2222public class ConfigFileHandler {
2323 public static void readFromConfig () {
2424 JsonObject root = new JsonObject ();
25- try (FileReader file = new FileReader (getConfigFile ())) {
26- root = JsonParser .parseReader (file ).getAsJsonObject ();
25+ try {
26+ File configFile = getConfigFile ();
27+ if (!configFile .exists ()) {
28+ writeToConfig ();
29+ configFile = getConfigFile ();
30+ }
31+ root = JsonParser .parseReader (new FileReader (configFile )).getAsJsonObject ();
2732 } catch (IOException e ) {
2833 Constants .log .error (e );
2934 }
@@ -106,7 +111,7 @@ public static void writeToConfig() {
106111 }
107112 }
108113
109- public static File getConfigFile () {
114+ public static File getConfigFile () throws IOException {
110115 return FabricLoader .getInstance ().getConfigDir ().resolve ("betteradvancements.json" ).toFile ();
111116 }
112117}
You can’t perform that action at this time.
0 commit comments