@@ -0,0 +1,2983 @@
+package com.elmakers.mine.bukkit.action.builtin;%0A%0Aimport com.elmakers.mine.bukkit.action.ActionHandler;%0Aimport com.elmakers.mine.bukkit.action.CompoundAction;%0Aimport com.elmakers.mine.bukkit.api.action.CastContext;%0Aimport com.elmakers.mine.bukkit.api.spell.SpellResult;%0Aimport com.elmakers.mine.bukkit.utility.ConfigurationUtils;%0Aimport org.bukkit.configuration.ConfigurationSection;%0Aimport org.bukkit.configuration.MemoryConfiguration;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class MultiplyAction extends CompoundAction%0A%7B%0A    private List%3CActionHandler%3E remaining = null;%0A    private List%3CActionHandler%3E multiplied = null;%0A    private int multiply;%0A%0A    public void prepare(CastContext context, ConfigurationSection parameters) %7B%0A        super.prepare(context, parameters);%0A        multiply = ConfigurationUtils.getInteger(parameters, %22multiply%22, 2);%0A        multiplied = new ArrayList%3CActionHandler%3E();%0A%0A        ActionHandler base = addHandler(%22actions%22);%0A        if (base != null)%0A        %7B%0A            ConfigurationSection initialParameters = parameters.getConfigurationSection(%22first%22);%0A            if (initialParameters != null)%0A            %7B%0A                ConfigurationSection combined = ConfigurationUtils.addConfigurations(new MemoryConfiguration(), parameters);%0A                initialParameters = ConfigurationUtils.addConfigurations(combined, initialParameters);%0A            %7D%0A            for (int i = 0; i %3C multiply; i++)%0A            %7B%0A                ActionHandler handler = (ActionHandler)base.clone();%0A                if (i == 0 && initialParameters != null)%0A                %7B%0A                    handler.prepare(context, initialParameters);%0A                %7D%0A                else%0A                %7B%0A                    handler.prepare(context, parameters);%0A                %7D%0A                multiplied.add(handler);%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void reset(CastContext context) %7B%0A        super.reset(context);%0A        remaining = new ArrayList%3CActionHandler%3E(multiplied);%0A        for (ActionHandler handler : remaining) %7B%0A            handler.reset(context);%0A        %7D%0A    %7D%0A%0A    @Override%0A%09public SpellResult perform(CastContext context) %7B%0A        SpellResult result = SpellResult.NO_ACTION;%0A        if (remaining.size() == 0) return result;%0A%0A        int startingWork = context.getWorkAllowed();%0A        List%3CActionHandler%3E subActions = new ArrayList%3CActionHandler%3E(remaining);%0A        remaining.clear();%0A        context.setWorkAllowed(0);%0A        int splitWork = Math.max(1, startingWork / subActions.size());%0A        for (ActionHandler action : subActions) %7B%0A            context.setWorkAllowed(context.getWorkAllowed() + splitWork);%0A            SpellResult actionResult = action.perform(context);%0A            context.addResult(actionResult);%0A            if (actionResult.isStop()) %7B%0A                remaining.add(action);%0A            %7D%0A            result = result.min(actionResult);%0A        %7D%0A%0A%09%09return result;%0A%09%7D%0A%7D%0A

Add Multiply action