aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-08 20:08:40 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-08 20:08:40 +0200
commit9624c38e07c7f18ec754cf5ee14d54df31e708dc (patch)
tree82845f3d0827042ce01dcd9a9b7c2b5a5a0ec028 /src/main/java/cc/polyfrost/oneconfig
parent618d1591edfcc688e4980bfc94f62e2992f7bec3 (diff)
downloadOneConfig-9624c38e07c7f18ec754cf5ee14d54df31e708dc.tar.gz
OneConfig-9624c38e07c7f18ec754cf5ee14d54df31e708dc.tar.bz2
OneConfig-9624c38e07c7f18ec754cf5ee14d54df31e708dc.zip
forgot to migrate vigilance comp layer oops
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java38
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java8
3 files changed, 24 insertions, 28 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
index a34b792..a753c7e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
@@ -1,5 +1,6 @@
package cc.polyfrost.oneconfig.config.compatibility.vigilance;
+import cc.polyfrost.oneconfig.config.core.ConfigUtils;
import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.Mod;
@@ -55,49 +56,44 @@ public class VigilanceConfig extends Config {
}
private void generateOptionsList(OptionPage page) {
- /*for (PropertyData option : ((VigilantAccessor) vigilant).getPropertyCollector().getProperties()) {
+ for (PropertyData option : ((VigilantAccessor) vigilant).getPropertyCollector().getProperties()) {
PropertyAttributesExt attributes = option.getAttributesExt();
if (attributes.getHidden()) continue;
- if (!page.categories.containsKey(getCategory(attributes)))
- page.categories.put(getCategory(attributes), new OptionCategory());
- OptionCategory category = page.categories.get(getCategory(attributes));
- if (category.subcategories.size() == 0 || !category.subcategories.get(category.subcategories.size() - 1).getName().equals(getSubcategory(attributes)))
- category.subcategories.add(new OptionSubcategory(getSubcategory(attributes)));
- ArrayList<BasicOption> options = category.subcategories.get(category.subcategories.size() - 1).options;
+ ArrayList<BasicOption> options = ConfigUtils.getSubCategory(page, getCategory(attributes), getSubcategory(attributes)).options;
switch (attributes.getType()) {
case SWITCH:
- options.add(new ConfigSwitch(getFieldOfProperty(option), option.getInstance(), getName(attributes), "", "", 2));
+ options.add(new ConfigSwitch(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), 2));
break;
case CHECKBOX:
- options.add(new ConfigCheckbox(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2));
+ options.add(new ConfigCheckbox(getFieldOfProperty(option), option.getInstance(), getName(attributes),getCategory(attributes), getSubcategory(attributes), 2));
break;
case PARAGRAPH:
case TEXT:
- options.add(new ConfigTextBox(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2, attributes.getPlaceholder(), attributes.getProtected(), attributes.getType() == PropertyType.PARAGRAPH));
+ options.add(new ConfigTextBox(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), 2, attributes.getPlaceholder(), attributes.getProtected(), attributes.getType() == PropertyType.PARAGRAPH));
break;
case SELECTOR:
- options.add(new ConfigDropdown(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2, attributes.getOptions().toArray(new String[0])));
+ options.add(new ConfigDropdown(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), 2, attributes.getOptions().toArray(new String[0])));
break;
case PERCENT_SLIDER:
- options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2, 0, 1, 0));
+ options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), 0, 1, 0));
break;
case DECIMAL_SLIDER:
- options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2, attributes.getMinF(), attributes.getMaxF(), 0));
+ options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), attributes.getMinF(), attributes.getMaxF(), 0));
break;
case SLIDER:
- options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2, attributes.getMin(), attributes.getMax(), 0));
+ options.add(new ConfigSlider(getFieldOfProperty(option), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), attributes.getMin(), attributes.getMax(), 0));
break;
case COLOR:
- options.add(new CompatConfigColorElement(getFieldOfProperty(option), option.getInstance(), getName(attributes), 2));
+ options.add(new CompatConfigColorElement(getFieldOfProperty(option), option.getInstance(), getCategory(attributes), getSubcategory(attributes), getName(attributes), 2));
break;
case BUTTON:
- options.add(new ConfigButton(() -> ((CallablePropertyValue) option.getValue()).invoke(option.getInstance()), option.getInstance(), getName(attributes), 2, attributes.getPlaceholder().isEmpty() ? "Activate" : attributes.getPlaceholder()));
+ options.add(new ConfigButton(() -> ((CallablePropertyValue) option.getValue()).invoke(option.getInstance()), option.getInstance(), getName(attributes), getCategory(attributes), getSubcategory(attributes), 2, attributes.getPlaceholder().isEmpty() ? "Activate" : attributes.getPlaceholder()));
break;
}
if (attributes.getType() == PropertyType.SWITCH || attributes.getType() == PropertyType.CHECKBOX) {
optionNames.put(PropertyKt.fullPropertyPath(option.getAttributesExt()), options.get(options.size() - 1));
}
- }*/
+ }
}
private Field getFieldOfProperty(PropertyData data) {
@@ -167,13 +163,13 @@ public class VigilanceConfig extends Config {
}
}
- /*private static class CompatConfigColorElement extends ConfigColorElement {
+ private static class CompatConfigColorElement extends ConfigColorElement {
private final Field color;
private Color prevColor = null;
private OneColor cachedColor = null;
- public CompatConfigColorElement(Field color, Vigilant parent, String name, int size) {
- super(null, parent, name, size);
+ public CompatConfigColorElement(Field color, Vigilant parent, String name, String category, String subcategory, int size) {
+ super(null, parent, name, category, subcategory, size);
this.color = color;
}
@@ -198,5 +194,5 @@ public class VigilanceConfig extends Config {
}
}
}
- }*/
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
index a254729..066fdd3 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
@@ -20,8 +20,8 @@ public class ConfigSlider extends BasicOption {
private boolean dragging = false;
private boolean mouseWasDown = false;
- public ConfigSlider(Field field, Object parent, String name, String category, String subcategory, int size, float min, float max, int step) {
- super(field, parent, name,category, subcategory, size);
+ public ConfigSlider(Field field, Object parent, String name, String category, String subcategory, float min, float max, int step) {
+ super(field, parent, name,category, subcategory, 2);
this.min = min;
this.max = max;
this.step = step;
@@ -30,7 +30,7 @@ public class ConfigSlider extends BasicOption {
public static ConfigSlider create(Field field, Object parent) {
Slider slider = field.getAnnotation(Slider.class);
- return new ConfigSlider(field, parent, slider.name(), slider.category(), slider.subcategory(), 2, slider.min(), slider.max(), slider.step());
+ return new ConfigSlider(field, parent, slider.name(), slider.category(), slider.subcategory(), slider.min(), slider.max(), slider.step());
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
index 758249a..3397264 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
@@ -31,13 +31,13 @@ public class HUDUtils {
options.get(options.size() - 1).addDependency(() -> hud.enabled);
options.add(new ConfigColorElement(hud.getClass().getField("borderColor"), hud, "Border color:", category, subcategory, 1));
options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.border);
- options.add(new ConfigSlider(hud.getClass().getField("cornerRadius"), hud, "Corner radius:", category, subcategory, 2, 0, 10, 0));
+ options.add(new ConfigSlider(hud.getClass().getField("cornerRadius"), hud, "Corner radius:", category, subcategory, 0, 10, 0));
options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.rounded);
- options.add(new ConfigSlider(hud.getClass().getField("borderSize"), hud, "Border thickness:", category, subcategory, 2, 0, 10, 0));
+ options.add(new ConfigSlider(hud.getClass().getField("borderSize"), hud, "Border thickness:", category, subcategory, 0, 10, 0));
options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.border);
- options.add(new ConfigSlider(hud.getClass().getField("paddingX"), hud, "X-Padding", category, subcategory, 2, 0, 50, 0));
+ options.add(new ConfigSlider(hud.getClass().getField("paddingX"), hud, "X-Padding", category, subcategory, 0, 50, 0));
options.get(options.size() - 1).addDependency(() -> hud.enabled);
- options.add(new ConfigSlider(hud.getClass().getField("paddingY"), hud, "Y-Padding", category, subcategory, 2, 0, 50, 0));
+ options.add(new ConfigSlider(hud.getClass().getField("paddingY"), hud, "Y-Padding", category, subcategory, 0, 50, 0));
options.get(options.size() - 1).addDependency(() -> hud.enabled);
} catch (NoSuchFieldException ignored) {
}