aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/config
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-02-27 19:24:01 +0100
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-02-27 19:24:01 +0100
commit321ea5ca5b4feebc4c695fc739db7765cac77ff1 (patch)
tree932e0977301e465dc0a1dc06b0ccb60b65f617ab /src/main/java/io/polyfrost/oneconfig/config
parent0b59caa89f1954a14a5c9538a29e874818fdbc78 (diff)
downloadOneConfig-321ea5ca5b4feebc4c695fc739db7765cac77ff1.tar.gz
OneConfig-321ea5ca5b4feebc4c695fc739db7765cac77ff1.tar.bz2
OneConfig-321ea5ca5b4feebc4c695fc739db7765cac77ff1.zip
Start on hud things
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/annotations/HudComponent.java13
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java13
2 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/HudComponent.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/HudComponent.java
new file mode 100644
index 0000000..5e1cd62
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/config/annotations/HudComponent.java
@@ -0,0 +1,13 @@
+package io.polyfrost.oneconfig.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface HudComponent {
+ String name();
+ String description() default "";
+}
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 4cd6fdf..2e3e92d 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
@@ -6,6 +6,8 @@ import io.polyfrost.oneconfig.config.core.ConfigCore;
import io.polyfrost.oneconfig.config.data.ModData;
import io.polyfrost.oneconfig.config.profiles.Profiles;
import io.polyfrost.oneconfig.gui.elements.config.*;
+import io.polyfrost.oneconfig.hud.HudCore;
+import io.polyfrost.oneconfig.hud.interfaces.BasicHud;
import java.io.*;
import java.lang.reflect.Field;
@@ -94,6 +96,17 @@ public class Config {
} else if (field.isAnnotationPresent(TextField.class)) {
TextField textField = field.getAnnotation(TextField.class);
options.add(new OConfigText(field, textField.name(), textField.description(), textField.placeholder(), textField.hideText()));
+ } else if (field.isAnnotationPresent(HudComponent.class)) {
+ HudComponent hudComponent = field.getAnnotation(HudComponent.class);
+ options.add(new OConfigHud(field, hudComponent.name(), hudComponent.description()));
+ try {
+ Object hud = field.get(BasicHud.class);
+ HudCore.huds.add((BasicHud) hud);
+ System.out.println("here");
+ System.out.println(HudCore.huds.size());
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
} else {
Option customOption = processCustomOption(field);
if (customOption != null)