aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/hud
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-08-10 10:15:01 +0200
committerGitHub <noreply@github.com>2022-08-10 17:15:01 +0900
commit091ce4c72c123f43f317c097818ace15f3a085fa (patch)
tree9a151e29494ef2683b2bff59fec19b56d4a05fb0 /src/main/java/cc/polyfrost/oneconfig/hud
parent799c389fdb993e363d71d268e0df9ae9f0a0c8a1 (diff)
downloadOneConfig-091ce4c72c123f43f317c097818ace15f3a085fa.tar.gz
OneConfig-091ce4c72c123f43f317c097818ace15f3a085fa.tar.bz2
OneConfig-091ce4c72c123f43f317c097818ace15f3a085fa.zip
Profile command (#88)
* e * omg finish profile shit * api and fix 1.12.2 preprocess * fix class names
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
index 526464e..2bc99bd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HUDUtils.java
@@ -40,6 +40,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Map;
public class HUDUtils {
public static void addHudOptions(OptionPage page, Field field, Object instance, Config config) {
@@ -48,7 +49,22 @@ public class HUDUtils {
Hud hud = (Hud) ConfigUtils.getField(field, instance);
if (hud == null) return;
hud.setConfig(config);
- HudCore.huds.add(hud);
+ HudCore.huds.put(new Map.Entry<Field, Object>() {
+ @Override
+ public Field getKey() {
+ return field;
+ }
+
+ @Override
+ public Object getValue() {
+ return instance;
+ }
+
+ @Override
+ public Object setValue(Object value) {
+ return null;
+ }
+ }, hud);
String category = hudAnnotation.category();
String subcategory = hudAnnotation.subcategory();
ArrayList<BasicOption> options = new ArrayList<>();
@@ -78,6 +94,7 @@ public class HUDUtils {
}
} catch (Exception ignored) {
}
+ HudCore.hudOptions.addAll(options);
ConfigUtils.getSubCategory(page, hudAnnotation.category(), hudAnnotation.subcategory()).options.addAll(options);
}
}