diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-27 14:48:10 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-27 14:48:10 +0200 |
commit | 61861be3663dc05883c387070c81eae9154444ef (patch) | |
tree | 7e06a816a7d6c7a4ee101a05d0c12710986dba2b /src/main/java/cc/polyfrost/oneconfig/config/migration | |
parent | d7ec593b877b6f41c6b5b431584789e9080aede7 (diff) | |
download | OneConfig-61861be3663dc05883c387070c81eae9154444ef.tar.gz OneConfig-61861be3663dc05883c387070c81eae9154444ef.tar.bz2 OneConfig-61861be3663dc05883c387070c81eae9154444ef.zip |
non profile specific system
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config/migration')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java index 4a9cd3b..f09d648 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java @@ -3,6 +3,7 @@ package cc.polyfrost.oneconfig.config.migration; import cc.polyfrost.oneconfig.config.compatibility.vigilance.VigilanceName; import java.io.BufferedReader; +import java.io.File; import java.io.FileReader; import java.lang.reflect.Field; import java.util.HashMap; @@ -16,13 +17,16 @@ public class VigilanceMigrator implements Migrator { private static final Pattern stringPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = \"(?<value>.+)\""); protected final String filePath; protected HashMap<String, HashMap<String, HashMap<String, Object>>> values = null; + protected final boolean fileExists; public VigilanceMigrator(String filePath) { this.filePath = filePath; + this.fileExists = new File(filePath).exists(); } @Override public Object getValue(Field field, String name, String category, String subcategory) { + if (!fileExists) return null; if (values == null) getOptions(); if (field.isAnnotationPresent(VigilanceName.class)) { VigilanceName annotation = field.getAnnotation(VigilanceName.class); |