<commit_before>package com.elmakers.mine.bukkit.spell;

import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;

import java.util.Collection;

public abstract class CompoundAction extends BaseSpellAction
{
	private boolean usesBrush = false;
	private boolean undoable = false;
	protected ActionHandler actions = null;

	@Override
	public void load(Spell spell, ConfigurationSection template)
	{
		super.load(spell, template);

		usesBrush = false;
		undoable = false;
		if (template.contains("actions"))
		{
			actions = new ActionHandler(getSpell());
			actions.load(template, "actions");
			usesBrush = usesBrush || actions.usesBrush();
			undoable = undoable || actions.isUndoable();
		}
		undoable = template.getBoolean("undoable", undoable);
	}

	protected SpellResult perform(ConfigurationSection parameters, Location targetLocation, Collection<Entity> targetEntities) {
		if (actions == null) {
			return SpellResult.FAIL;
		}

		for (Entity entity : targetEntities) {
			addTargetEntity(entity);
		}
		return actions.perform(parameters, targetLocation, targetEntities);
	}

	@Override
	public boolean isUndoable()
	{
		return undoable;
	}

	@Override
	public boolean usesBrush()
	{
		return usesBrush;
	}<commit_msg>Change the way projectile actions are configured.<commit_after>package com.elmakers.mine.bukkit.spell;

import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;

import java.util.Collection;

public abstract class CompoundAction extends BaseSpellAction
{
	private boolean usesBrush = false;
	private boolean undoable = false;
	protected ActionHandler actions = null;

	@Override
	public void load(Spell spell, ConfigurationSection template)
	{
		super.load(spell, template);

		usesBrush = false;
		undoable = false;
		if (template != null && template.contains("actions"))
		{
			actions = new ActionHandler(getSpell());
			actions.load(template, "actions");
			usesBrush = usesBrush || actions.usesBrush();
			undoable = undoable || actions.isUndoable();
		}
		undoable = template.getBoolean("undoable", undoable);
	}

	protected SpellResult perform(ConfigurationSection parameters, Location targetLocation, Collection<Entity> targetEntities) {
		if (actions == null) {
			return SpellResult.FAIL;
		}

		for (Entity entity : targetEntities) {
			addTargetEntity(entity);
		}
		return actions.perform(parameters, targetLocation, targetEntities);
	}

	@Override
	public boolean isUndoable()
	{
		return undoable;
	}

	@Override
	public boolean usesBrush()
	{
		return usesBrush;
	}
{'fraction_non_alphanumeric': 0.10404040404040404, 'fraction_numerical': 0.0, 'mean_word_length': 5.088114754098361, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7249360', 'n_tokens_mistral': 966, 'n_tokens_neox': 886, 'n_words': 206}