<commit_before>package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import com.elmakers.mine.bukkit.spell.BaseSpell;
import org.bukkit.configuration.ConfigurationSection;

import java.util.Arrays;
import java.util.Collection;

public class DelayAction extends BaseSpellAction
{
    private int delay;
    private long targetTime;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        delay = parameters.getInt("delay", 1);
    }

    @Override
    public void reset(CastContext context)
    {
        super.reset(context);
        targetTime = System.currentTimeMillis() + delay;
    }

	@Override
	public SpellResult perform(CastContext context) {
        if (System.currentTimeMillis() < targetTime)
        {
            return SpellResult.PENDING;
        }
		return SpellResult.NO_ACTION;
	}
<commit_msg>Delay should not start until the action is triggered (fix using multiple Delay blocks in a row)<commit_after>package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import com.elmakers.mine.bukkit.spell.BaseSpell;
import org.bukkit.configuration.ConfigurationSection;

import java.util.Arrays;
import java.util.Collection;

public class DelayAction extends BaseSpellAction
{
    private int delay;
    private Long targetTime;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        delay = parameters.getInt("delay", 1);
    }

    @Override
    public void reset(CastContext context)
    {
        super.reset(context);
        targetTime = null;
    }

	@Override
	public SpellResult perform(CastContext context) {
        if (targetTime == null) {
            targetTime = System.currentTimeMillis() + delay;
            return SpellResult.PENDING;
        }
        if (System.currentTimeMillis() < targetTime)
        {
            return SpellResult.PENDING;
        }
		return SpellResult.NO_ACTION;
	}

{'fraction_non_alphanumeric': 0.092295014421096, 'fraction_numerical': 0.0008240626287597857, 'mean_word_length': 3.4714548802946594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5397283', 'n_tokens_mistral': 710, 'n_tokens_neox': 713, 'n_words': 147}