diff --git a/src/com/projectkorra/projectkorra/ability/CoreAbility.java b/src/com/projectkorra/projectkorra/ability/CoreAbility.java index cdfb4c9e..b0ef664b 100644 --- a/src/com/projectkorra/projectkorra/ability/CoreAbility.java +++ b/src/com/projectkorra/projectkorra/ability/CoreAbility.java @@ -88,6 +88,7 @@ public abstract class CoreAbility implements Ability { private static final double DEFAULT_COLLISION_RADIUS = 0.3; private static final List ADDON_PLUGINS = new ArrayList<>(); private static final Map, Map> ATTRIBUTE_FIELDS = new HashMap<>(); + private static final Field[] EMPTY_FIELDS = new Field[0]; private static int idCounter; @@ -450,6 +451,26 @@ public abstract class CoreAbility implements Ability { return ADDON_PLUGINS; } + public static Field getAttributeField(Class ability, String attribute) { + Map attributes = ATTRIBUTE_FIELDS.get(ability); + + if (attributes == null) { + return null; + } + + return attributes.get(attribute); + } + + public static Field[] getAttributeFields(Class ability) { + Map attributes = ATTRIBUTE_FIELDS.get(ability); + + if (attributes == null) { + return EMPTY_FIELDS; + } + + return attributes.values().toArray(EMPTY_FIELDS); + } + /** * Returns true if the player has an active CoreAbility instance of type T. *