aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java13
1 files changed, 10 insertions, 3 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 ce73f0c..f592152 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
@@ -15,8 +15,7 @@ import java.util.Map;
public class Config {
private final File configFile;
-
- Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting()
+ private final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting()
.registerTypeAdapterFactory(OneConfigTypeAdapterFactory.getStaticTypeAdapterFactory()).create();
/**
@@ -88,12 +87,20 @@ public class Config {
} else if (field.isAnnotationPresent(TextField.class)) {
TextField textField = field.getAnnotation(TextField.class);
options.add(new OConfigText(field, textField.name(), textField.description(), textField.placeholder(), textField.hideText()));
- }
+ } else loadCustomType(field);
}
return options;
}
/**
+ * Overwrite this method to add your own custom option types
+ *
+ * @param field target field
+ */
+ protected void loadCustomType(Field field) {
+ }
+
+ /**
* Deserialize part of config and load values
*
* @param json json to deserialize