diff --git a/core/src/main/java/tc/oc/pgm/action/ActionParser.java b/core/src/main/java/tc/oc/pgm/action/ActionParser.java index c35e569a85..0557a9d922 100644 --- a/core/src/main/java/tc/oc/pgm/action/ActionParser.java +++ b/core/src/main/java/tc/oc/pgm/action/ActionParser.java @@ -9,6 +9,7 @@ import net.kyori.adventure.title.Title; import org.bukkit.inventory.ItemStack; import org.jdom2.Element; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import tc.oc.pgm.action.actions.ActionNode; import tc.oc.pgm.action.actions.KillEntitiesAction; @@ -89,6 +90,17 @@ public Action parseReference(Node node, String id, Class bound return action; } + public > Action parseProperty( + @NotNull Node node, Class bound) throws InvalidXMLException { + if (node.isAttribute()) return this.parseReference(node, bound); + + ActionNode result = this.parseAction(node.getElement(), bound); + + if (bound != null) validate(result, ActionScopeValidation.of(bound), node); + features.addFeature(node.getElement(), result); + return result; + } + @SuppressWarnings("rawtypes, unchecked") public void validate( Action action, FeatureValidation> validation, Node node) @@ -126,8 +138,8 @@ public > Trigger parseTrigger(Element el) throws Inva Class cls = Filterables.parse(Node.fromRequiredAttr(el, "scope")); return new Trigger<>( cls, - filters.parseReference(Node.fromRequiredAttr(el, "filter")), - parseReference(Node.fromRequiredAttr(el, "trigger", "action"), cls)); + filters.parseProperty(el, "filter"), + parseProperty(Node.fromRequiredChildOrAttr(el, "trigger", "action"), cls)); } private > Class parseScope(Element el, Class scope)