diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-27 18:36:51 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-27 18:36:51 +0200 |
commit | ee479dddc391a2cfb961ba1751e14884e933d3ff (patch) | |
tree | ad88f551255b0069dfa46ec4aa4814d7f49e97c7 /src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java | |
parent | a93ec306e83f51e121441cb00f04cd9bb36d6951 (diff) | |
download | OneConfig-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.java | 10 |
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; } } |