aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-27 18:36:51 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-27 18:36:51 +0200
commitee479dddc391a2cfb961ba1751e14884e933d3ff (patch)
treead88f551255b0069dfa46ec4aa4814d7f49e97c7 /src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
parenta93ec306e83f51e121441cb00f04cd9bb36d6951 (diff)
downloadOneConfig-ee479dddc391a2cfb961ba1751e14884e933d3ff.tar.gz
OneConfig-ee479dddc391a2cfb961ba1751e14884e933d3ff.tar.bz2
OneConfig-ee479dddc391a2cfb961ba1751e14884e933d3ff.zip
Option page start
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java10
1 files changed, 5 insertions, 5 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 0539d5f..cbb7610 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
@@ -34,7 +34,7 @@ public class Config {
if (Profiles.getProfileFile(configFile).exists()) load();
else save();
mod.config = this;
- generateOptionList(this.getClass(), mod.defaultPage);
+ generateOptionList(this.getClass(), mod.defaultPage, mod);
ConfigCore.oneConfigMods.add(mod);
}
@@ -66,7 +66,7 @@ public class Config {
* @param clazz target class
* @param page page to add options too
*/
- protected void generateOptionList(Class<?> clazz, OptionPage page) {
+ protected void generateOptionList(Class<?> clazz, OptionPage page, Mod mod) {
for (Field field : clazz.getDeclaredFields()) {
System.out.println(field);
if (!field.isAnnotationPresent(Option.class)) {
@@ -81,11 +81,11 @@ public class Config {
ArrayList<BasicOption> options = page.categories.get(option.category()).get(option.subcategory());
switch (option.type()) {
case PAGE:
- OptionPage newPage = new OptionPage(option.name());
+ OptionPage newPage = new OptionPage(option.name(), mod);
try {
field.setAccessible(true);
Object object = field.get(clazz);
- generateOptionList(object.getClass(), newPage);
+ generateOptionList(object.getClass(), newPage, mod);
System.out.println(newPage.categories);
options.add(new ConfigPage(field, option.name(), option.description(), option.size(), newPage));
} catch (IllegalAccessException e) {
@@ -93,7 +93,7 @@ public class Config {
}
break;
case SWITCH:
- options.add(new ConfigSwitch(field, option.name(), option.description(), option.size()));
+ options.add(new ConfigSwitch(field, option.name(), option.size()));
break;
}
}