diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-05 08:56:26 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-05 08:56:26 +0200 |
commit | 7a6a31c7c5040959b47f55ec96fb614dfb4d8efb (patch) | |
tree | cd073a8c6a68d7ce133e17f7b2eec97ec90611a4 /src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java | |
parent | 2aeadc2dd30c23aac6bb1d0a349720f28f2609ec (diff) | |
download | CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.tar.gz CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.tar.bz2 CITResewn-7a6a31c7c5040959b47f55ec96fb614dfb4d8efb.zip |
Documentation (23/44, 0/35)
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java index 2f051f0..cd66fed 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfig.java @@ -2,22 +2,54 @@ package shcm.shsupercm.fabric.citresewn.config; import com.google.gson.Gson; import com.google.gson.stream.JsonWriter; +import net.fabricmc.loader.api.FabricLoader; import org.apache.commons.io.IOUtils; import shcm.shsupercm.fabric.citresewn.CITResewn; import java.io.*; +/** + * Contains runtime representation of CIT Resewn's config, encoded using GSON. + */ public class CITResewnConfig { + /** + * Whether CIT Resewn should work or not.<br> + * Requires a restart. + */ public boolean enabled = true; + /** + * Mutes pack loading errors from logs. + */ public boolean mute_errors = false; + /** + * Mutes pack loading warnings from logs. + */ public boolean mute_warns = false; + /** + * Invalidating interval for CITs' caches in milliseconds. Set to 0 to disable caching. + */ public int cache_ms = 50; + /** + * Should broken paths be allowed in resourcepacks. Requires a restart. + * @see BrokenPaths + */ public boolean broken_paths = false; - private static final File FILE = new File("config/citresewn.json"); + /** + * CIT Resewn's config storage file. + */ + private static final File FILE = new File(FabricLoader.getInstance().getConfigDir().toFile(), "citresewn.json"); + /** + * Active instance of the current config. + */ public static final CITResewnConfig INSTANCE = read(); + /** + * Reads the stored config. + * @see #FILE + * @return the read config + */ public static CITResewnConfig read() { if (!FILE.exists()) return new CITResewnConfig().write(); @@ -33,6 +65,11 @@ public class CITResewnConfig { } } + /** + * Saves this config to file. + * @see #FILE + * @return this + */ public CITResewnConfig write() { Gson gson = new Gson(); JsonWriter writer = null; |