diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-04 14:53:10 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-04 14:53:10 +0200 |
commit | ddca3a3232eff15a7130efda03e7e5c408554412 (patch) | |
tree | ef7678412590ca432bb2cd25aabfc3bf2ea4b7b0 /src/main/java/io/polyfrost/oneconfig/config/interfaces | |
parent | 1210e38c2ff569a28b20d7d0182557fbf386d524 (diff) | |
parent | 2696141f9790fd6c8d3df1148f46d298512c4902 (diff) | |
download | OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.gz OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.bz2 OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.zip |
merge
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config/interfaces')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java | 12 | ||||
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/config/interfaces/Option.java | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java index 2e3e92d..73dbbe7 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java @@ -20,8 +20,7 @@ import java.util.Optional; public class Config { protected final String configFile; - protected final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting() - .registerTypeAdapterFactory(OneConfigTypeAdapterFactory.getStaticTypeAdapterFactory()).create(); + protected final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting().registerTypeAdapterFactory(OneConfigTypeAdapterFactory.getStaticTypeAdapterFactory()).create(); /** * @param modData information about the mod @@ -33,10 +32,8 @@ public class Config { } public void init(ModData modData) { - if (Profiles.getProfileFile(configFile).exists()) - load(); - else - save(); + if (Profiles.getProfileFile(configFile).exists()) load(); + else save(); modData.config = this; ConfigCore.settings.put(modData, generateOptionList(this.getClass())); } @@ -109,8 +106,7 @@ public class Config { } } else { Option customOption = processCustomOption(field); - if (customOption != null) - options.add(customOption); + if (customOption != null) options.add(customOption); } } return options; diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Option.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Option.java index 5980a63..99cf656 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Option.java +++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Option.java @@ -19,8 +19,7 @@ public abstract class Option { this.field = field; this.name = name; this.description = description; - if (field != null) - field.setAccessible(true); + if (field != null) field.setAccessible(true); } /** |