From ee479dddc391a2cfb961ba1751e14884e933d3ff Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Wed, 27 Apr 2022 18:36:51 +0200 Subject: Option page start --- .../java/io/polyfrost/oneconfig/config/interfaces/Config.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java') 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 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; } } -- cgit