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

import com.elmakers.mine.bukkit.api.action.SpellAction;
import com.elmakers.mine.bukkit.api.effect.EffectPlayer;
import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.api.spell.MageSpell;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;

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

public abstract class BaseSpellAction implements SpellAction
{
    private Spell spell;
    private BaseSpell baseSpell;
    private BlockSpell blockSpell;
    private MageSpell mageSpell;
    private UndoableSpell undoSpell;
    private ActionSpell actionSpell;
    private ConfigurationSection parameters;

    public void registerModified(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerModified(entity);
        }
    }

    public void registerForUndo(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerForUndo(entity);
        }
    }

    public void registerVelocity(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerVelocity(entity);
        }
    }

    public void registerMoved(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerMoved(entity);
        }
    }

    public void registerPotionEffects(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerPotionEffects(entity);
        }
    }

    public ActionHandler getActions(String key) {
        if (actionSpell != null)
        {
            return actionSpell.getActions(key);
        }
        return null;
    }

    public Vector getDirection() {
        return baseSpell != null ? baseSpell.getDirection() : null;
    }

    public Location getLocation() {
        return baseSpell != null ? baseSpell.getLocation() : null;
    }

    public Location getEyeLocation() {
        return baseSpell != null ? baseSpell.getEyeLocation() : null;
    }

    public boolean isIndestructible(Block block) {
        return blockSpell != null ? blockSpell.isIndestructible(block) : true;
    }

    public boolean hasBuildPermission(Block block) {
        return blockSpell != null ? blockSpell.hasBuildPermission(block) : false;
    }

    public Collection<EffectPlayer> getEffects(String key) {
        return spell.getEffects(key);
    }

    public Collection<PotionEffect> getPotionEffects(ConfigurationSection parameters, Integer duration) {
        return baseSpell != null ? baseSpell.getPotionEffects(parameters, duration) : null;
    }

    public Mage getMage()
    {
        return mageSpell == null ? null : mageSpell.getMage();
    }

    public MageController getController() {
        Mage mage = getMage();
        return mage == null ? null : mage.getController();
    }

    @Override
    public void load(Spell spell, ConfigurationSection parameters)
    {
        this.spell = spell;
        if (spell instanceof BaseSpell)
        {
            this.baseSpell = (BaseSpell)spell;
        }
        if (spell instanceof MageSpell)
        {
            this.mageSpell = (MageSpell)spell;
        }
        if (spell instanceof UndoableSpell)
        {
            this.undoSpell = (UndoableSpell)spell;
        }
        if (spell instanceof ActionSpell)
        {
            this.actionSpell = (ActionSpell)spell;
        }
        if (spell instanceof BlockSpell)
        {
            this.blockSpell = (BlockSpell)spell;
        }
        this.parameters = parameters;
    }

    @Override
    public ConfigurationSection getParameters(ConfigurationSection baseParameters)
    {
        if (parameters == null)
        {
            return baseParameters;
        }
        ConfigurationSection combined = new MemoryConfiguration();
        ConfigurationUtils.addConfigurations(combined, baseParameters);
        ConfigurationUtils.addConfigurations(combined, parameters);
        return combined;
    }

    @Override
    public void prepare(ConfigurationSection parameters) {

    }

    @Override
    public boolean usesBrush()
    {
        return false;
    }

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

    public Spell getSpell() {
        return spell;
    }

    @Override
    public void getParameterNames(Collection<String> parameters) {<commit_msg>Implement placeholder finish method in BaseSpellAction<commit_after>package com.elmakers.mine.bukkit.spell;

import com.elmakers.mine.bukkit.api.action.SpellAction;
import com.elmakers.mine.bukkit.api.effect.EffectPlayer;
import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.api.spell.MageSpell;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;

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

public abstract class BaseSpellAction implements SpellAction
{
    private Spell spell;
    private BaseSpell baseSpell;
    private BlockSpell blockSpell;
    private MageSpell mageSpell;
    private UndoableSpell undoSpell;
    private ActionSpell actionSpell;
    private ConfigurationSection parameters;

    public void registerModified(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerModified(entity);
        }
    }

    public void registerForUndo(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerForUndo(entity);
        }
    }

    public void registerVelocity(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerVelocity(entity);
        }
    }

    public void registerMoved(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerMoved(entity);
        }
    }

    public void registerPotionEffects(Entity entity)
    {
        if (undoSpell != null)
        {
            undoSpell.registerPotionEffects(entity);
        }
    }

    public ActionHandler getActions(String key) {
        if (actionSpell != null)
        {
            return actionSpell.getActions(key);
        }
        return null;
    }

    public Vector getDirection() {
        return baseSpell != null ? baseSpell.getDirection() : null;
    }

    public Location getLocation() {
        return baseSpell != null ? baseSpell.getLocation() : null;
    }

    public Location getEyeLocation() {
        return baseSpell != null ? baseSpell.getEyeLocation() : null;
    }

    public boolean isIndestructible(Block block) {
        return blockSpell != null ? blockSpell.isIndestructible(block) : true;
    }

    public boolean hasBuildPermission(Block block) {
        return blockSpell != null ? blockSpell.hasBuildPermission(block) : false;
    }

    public Collection<EffectPlayer> getEffects(String key) {
        return spell.getEffects(key);
    }

    public Collection<PotionEffect> getPotionEffects(ConfigurationSection parameters, Integer duration) {
        return baseSpell != null ? baseSpell.getPotionEffects(parameters, duration) : null;
    }

    public Mage getMage()
    {
        return mageSpell == null ? null : mageSpell.getMage();
    }

    public MageController getController() {
        Mage mage = getMage();
        return mage == null ? null : mage.getController();
    }

    @Override
    public void load(Spell spell, ConfigurationSection parameters)
    {
        this.spell = spell;
        if (spell instanceof BaseSpell)
        {
            this.baseSpell = (BaseSpell)spell;
        }
        if (spell instanceof MageSpell)
        {
            this.mageSpell = (MageSpell)spell;
        }
        if (spell instanceof UndoableSpell)
        {
            this.undoSpell = (UndoableSpell)spell;
        }
        if (spell instanceof ActionSpell)
        {
            this.actionSpell = (ActionSpell)spell;
        }
        if (spell instanceof BlockSpell)
        {
            this.blockSpell = (BlockSpell)spell;
        }
        this.parameters = parameters;
    }

    @Override
    public ConfigurationSection getParameters(ConfigurationSection baseParameters)
    {
        if (parameters == null)
        {
            return baseParameters;
        }
        ConfigurationSection combined = new MemoryConfiguration();
        ConfigurationUtils.addConfigurations(combined, baseParameters);
        ConfigurationUtils.addConfigurations(combined, parameters);
        return combined;
    }

    @Override
    public void prepare(ConfigurationSection parameters) {

    }

    @Override
    public void finish(ConfigurationSection parameters) {

    }

    @Override
    public boolean usesBrush()
    {
        return false;
    }

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

    public Spell getSpell() {
        return spell;
    }

    @Override
    public void getParameterNames(Collection<String> parameters) {
{'fraction_non_alphanumeric': 0.0854198866563627, 'fraction_numerical': 0.0, 'mean_word_length': 2.5179412830735775, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3956163', 'n_tokens_mistral': 2692, 'n_tokens_neox': 2725, 'n_words': 572}