package com.elmakers.mine.bukkit.action.builtin;

import java.util.Collection;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.action.CheckAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;

public class CheckTriggerAction extends CheckAction {
    private String trigger;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters)
    {
        super.prepare(context, parameters);
        trigger = parameters.getString("trigger", "");
    }

    @Override
    protected boolean isAllowed(CastContext context) {
        Long lastTrigger = context.getMage().getLastTrigger(trigger);
        return (lastTrigger != null && lastTrigger > context.getStartTime());
    }

    @Override
    public void getParameterNames(Spell spell, Collection<String> parameters) {
        super.getParameterNames(spell, parameters);
        parameters.add("trigger");
    }
}

@@ -340,16 +340,82 @@
 ction %7B%0A
+    private boolean sinceStartOfCast;%0A    private long startTime;%0A
     priv
@@ -628,24 +628,218 @@
 gger%22, %22%22);%0A
+        sinceStartOfCast = parameters.getBoolean(%22since_start_of_cast%22, false);%0A    %7D%0A%0A    @Override%0A    public void reset(CastContext context) %7B%0A        startTime = System.currentTimeMillis();%0A
     %7D%0A%0A    @
@@ -972,16 +972,101 @@
 igger);%0A
+        long startTime = sinceStartOfCast ? context.getStartTime() : this.startTime;%0A
         
@@ -1110,36 +1110,25 @@
 igger %3E 
-context.getS
+s
 tartTime
 ());%0A   
@@ -1119,18 +1119,16 @@
 tartTime
-()
 );%0A    %7D

Change CheckTrigger action to be retriggerable