Search in sources :

Example 1 with ArgumentContributionDelegate

use of net.robinfriedli.aiode.command.argument.ArgumentContributionDelegate in project aiode by robinfriedli.

the class InitialiseCommandContributionsTask method perform.

@Override
public void perform(@Nullable JDA shard) throws Exception {
    Context commandContributionContext = commandManager.getCommandContributionContext();
    @SuppressWarnings("rawtypes") List<CommandHierarchyNode> commandHierarchyNodes = commandContributionContext.getInstancesOf(CommandHierarchyNode.class);
    for (@SuppressWarnings("unchecked") CommandHierarchyNode<ArgumentContributionDelegate> commandHierarchyNode : commandHierarchyNodes) {
        Map<String, ArgumentContributionDelegate> argumentContributions = commandHierarchyNode.getArguments();
        for (ArgumentContributionDelegate argumentContributionDelegate : argumentContributions.values()) {
            ArgumentContribution argumentContribution = argumentContributionDelegate.unwrapArgumentContribution();
            List<XmlElement> excludedArguments = argumentContribution.getExcludedArguments();
            List<XmlElement> requiredArguments = argumentContribution.getRequiredArguments();
            validateReferencedArguments(commandHierarchyNode, argumentContribution, excludedArguments);
            validateReferencedArguments(commandHierarchyNode, argumentContribution, requiredArguments);
        }
    }
}
Also used : Context(net.robinfriedli.jxp.persist.Context) CommandHierarchyNode(net.robinfriedli.aiode.entities.xml.CommandHierarchyNode) XmlElement(net.robinfriedli.jxp.api.XmlElement) ArgumentContributionDelegate(net.robinfriedli.aiode.command.argument.ArgumentContributionDelegate) ArgumentContribution(net.robinfriedli.aiode.entities.xml.ArgumentContribution)

Aggregations

ArgumentContributionDelegate (net.robinfriedli.aiode.command.argument.ArgumentContributionDelegate)1 ArgumentContribution (net.robinfriedli.aiode.entities.xml.ArgumentContribution)1 CommandHierarchyNode (net.robinfriedli.aiode.entities.xml.CommandHierarchyNode)1 XmlElement (net.robinfriedli.jxp.api.XmlElement)1 Context (net.robinfriedli.jxp.persist.Context)1