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

import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;
import me.blackvein.quests.CustomReward;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Server;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import java.util.Map;

public class SpellCastReward extends CustomReward {

    // This boilerplate cannot be abstracted due to the class-scanning that Quests does
    private static MagicAPI api;
    protected static MagicAPI getAPI(Server server) {
        if (api == null) {
            Plugin magicPlugin = server.getPluginManager().getPlugin("Magic");
            if (magicPlugin != null && magicPlugin instanceof MagicAPI) {
                api = (MagicAPI)magicPlugin;
            }
        }

        return api;
    }

    public SpellCastReward() {
        this.setName("Spell Cast");
        this.setAuthor("NathanWolf");
        this.setRewardName("Magical Event");
        this.addData("Spell");
        this.addDescription("Spell", "The KEY name of the Magic spell to cast as the player.");
        this.addData("Parameters");
        this.addDescription("Parameters", "Any parameters to pass to the spell on cast.");
    }

    @Override
    public void giveReward(Player player, Map<String, Object> stringObjectMap) {
        MagicAPI api = getAPI(player.getServer());
        String spellKey = (String)stringObjectMap.get("Spell");
        if (spellKey != null) {
            String[] extraParameters = StringUtils.split((String)stringObjectMap.get("Spell"), ",");
            ConfigurationSection parameters = null;
            if (extraParameters != null && extraParameters.length > 0) {
                parameters = new MemoryConfiguration();
                ConfigurationUtils.addParameters(extraParameters, parameters);
            }
            api.cast(spellKey, parameters, player, player);
        }
    }
}
<commit_msg>Some fixes to the spell cast reward<commit_after>package com.elmakers.mine.bukkit.magicquests;

import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;
import me.blackvein.quests.CustomReward;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Server;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import java.util.Map;

public class SpellCastReward extends CustomReward {

    // This boilerplate cannot be abstracted due to the class-scanning that Quests does
    private static MagicAPI api;
    protected static MagicAPI getAPI(Server server) {
        if (api == null) {
            Plugin magicPlugin = server.getPluginManager().getPlugin("Magic");
            if (magicPlugin != null && magicPlugin instanceof MagicAPI) {
                api = (MagicAPI)magicPlugin;
            }
        }

        return api;
    }

    public SpellCastReward() {
        this.setName("Spell Cast");
        this.setAuthor("NathanWolf");
        this.setRewardName("Magical Event");
        this.addData("Spell");
        this.addDescription("Spell", "The KEY name of the Magic spell to cast as the player.");
        this.addData("Parameters");
        this.addDescription("Parameters", "Any parameters to pass to the spell on cast.");
    }

    @Override
    public void giveReward(Player player, Map<String, Object> stringObjectMap) {
        MagicAPI api = getAPI(player.getServer());
        String spellKey = (String)stringObjectMap.get("Spell");
        if (spellKey != null) {
            String[] extraParameters = StringUtils.split((String)stringObjectMap.get("Parameters"), ' ');
            ConfigurationSection parameters = null;
            if (extraParameters != null && extraParameters.length > 0) {
                parameters = new MemoryConfiguration();
                ConfigurationUtils.addParameters(extraParameters, parameters);
            }
            api.cast(spellKey, parameters, player, player);
        }
    }
}

{'fraction_non_alphanumeric': 0.10455510974746282, 'fraction_numerical': 0.0004720320981826764, 'mean_word_length': 3.0208728652751424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6890791', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1116, 'n_words': 274}