aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
index e91a7ce..a67177c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
@@ -1,5 +1,6 @@
package cc.polyfrost.oneconfig.hud;
+import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.config.annotations.HUD;
import cc.polyfrost.oneconfig.config.core.ConfigUtils;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
@@ -11,10 +12,11 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
public class HUDUtils {
- public static void addHudOptions(OptionPage page, Field field, Object instance) {
+ public static void addHudOptions(OptionPage page, Field field, Object instance, Config config) {
HUD hudAnnotation = field.getAnnotation(HUD.class);
Hud hud = (Hud) ConfigUtils.getField(field, instance);
if (hud == null) return;
+ hud.setConfig(config);
HudCore.huds.add(hud);
String category = hudAnnotation.category();
String subcategory = hudAnnotation.subcategory();
@@ -24,21 +26,21 @@ public class HUDUtils {
options.add(new ConfigSwitch(hud.getClass().getField("enabled"), hud, "Enabled", category, subcategory, 2));
options.addAll(ConfigUtils.getClassOptions(hud));
options.add(new ConfigCheckbox(hud.getClass().getField("rounded"), hud, "Rounded corners", category, subcategory, 1));
- options.get(options.size() - 1).addDependency(() -> hud.enabled);
+ options.get(options.size() - 1).addDependency(hud::isEnabled);
options.add(new ConfigCheckbox(hud.getClass().getField("border"), hud, "Outline/border", category, subcategory, 1));
- options.get(options.size() - 1).addDependency(() -> hud.enabled);
+ options.get(options.size() - 1).addDependency(hud::isEnabled);
options.add(new ConfigColorElement(hud.getClass().getField("bgColor"), hud, "Background color:", category, subcategory, 1, true));
- options.get(options.size() - 1).addDependency(() -> hud.enabled);
+ options.get(options.size() - 1).addDependency(hud::isEnabled);
options.add(new ConfigColorElement(hud.getClass().getField("borderColor"), hud, "Border color:", category, subcategory, 1, true));
- options.get(options.size() - 1).addDependency(() -> hud.enabled && hud.border);
+ options.get(options.size() - 1).addDependency(() -> hud.isEnabled() && hud.border);
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.get(options.size() - 1).addDependency(() -> hud.isEnabled() && hud.rounded);
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.get(options.size() - 1).addDependency(() -> hud.isEnabled() && hud.border);
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.get(options.size() - 1).addDependency(hud::isEnabled);
options.add(new ConfigSlider(hud.getClass().getField("paddingY"), hud, "Y-Padding", category, subcategory, 0, 50, 0));
- options.get(options.size() - 1).addDependency(() -> hud.enabled);
+ options.get(options.size() - 1).addDependency(hud::isEnabled);
} catch (NoSuchFieldException ignored) {
}
}