aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-11 10:29:58 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-11 10:29:58 +0200
commitd888d6b7358226792bf0cedbe67c7bb26204983f (patch)
treeef012f65d06d1520312f51e8ccea79384b78e23c
parent7abfe87ea8fcda67ce4bb6089b61f0efd82bec47 (diff)
downloadOneConfig-d888d6b7358226792bf0cedbe67c7bb26204983f.tar.gz
OneConfig-d888d6b7358226792bf0cedbe67c7bb26204983f.tar.bz2
OneConfig-d888d6b7358226792bf0cedbe67c7bb26204983f.zip
fix dependencies
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/Config.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java1
3 files changed, 6 insertions, 4 deletions
diff --git a/gradle.properties b/gradle.properties
index be58d47..2d80be3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
mod_name = OneConfig
mod_id = oneconfig
-mod_version = 0.1.0-alpha3
+mod_version = 0.1.0-alpha4
loom.platform = forge
essential.defaults.loom=0
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
index 2ba5077..62609d4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
@@ -93,13 +93,14 @@ public class Config {
protected void generateOptionList(Object instance, OptionPage page, Mod mod, boolean migrate) {
for (Field field : instance.getClass().getDeclaredFields()) {
Option option = ConfigUtils.findAnnotation(field, Option.class);
+ String optionName = (page.equals(mod.defaultPage) ? "" : page.name + ".") + field.getName();
if (option != null) {
BasicOption configOption = ConfigUtils.addOptionToPage(page, option, field, instance, migrate ? mod.migrator : null);
- optionNames.put(page.equals(mod.defaultPage) ? "" : page.name + "." + field.getName(), configOption);
+ optionNames.put(optionName, configOption);
} else if (field.isAnnotationPresent(CustomOption.class)) {
BasicOption configOption = getCustomOption(field, page, mod, migrate);
if (configOption == null) continue;
- optionNames.put(page.equals(mod.defaultPage) ? "" : page.name + "." + field.getName(), configOption);
+ optionNames.put(optionName, configOption);
} else if (field.isAnnotationPresent(Page.class)) {
Page optionPage = field.getAnnotation(Page.class);
OptionSubcategory subcategory = ConfigUtils.getSubCategory(page, optionPage.category(), optionPage.subcategory());
@@ -196,7 +197,7 @@ public class Config {
/**
* Disable an option if a certain condition is not met
*
- * @param option The name of the field, or if the field is in a page "pageName.fieldName"
+ * @param option The name of the field, or if the field is in a page "pageName.fieldName"
* @param value The value of the dependency
*/
protected void addDependency(String option, boolean value) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
index aee6d6b..8279353 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
@@ -121,6 +121,7 @@ public class TestConfig_Test extends Config {
public TestConfig_Test() {
super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json");
+ addDependency("testCheckBox", "testSwitch");
}
}