<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.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import com.elmakers.mine.bukkit.api.spell.SpellTemplate;
import com.elmakers.mine.bukkit.magic.MagicPlugin;
import com.elmakers.mine.bukkit.utility.InventoryUtils;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.Collection;
import java.util.List;

public class GiveItemAction extends BaseSpellAction
{
    private ItemStack item = null;
    private ItemStack requireItem = null;
    private String permissionNode = null;

    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        MageController controller = context.getController();

        permissionNode = parameters.getString("permission", null);
        String itemKey = parameters.getString("item");
        item = controller.createItem(itemKey);
        if (item == null) {
            context.getLogger().warning("Invalid item: " + itemKey);
        }
        else
        {
            String name = parameters.getString("name", null);
            List<String> lore = parameters.getStringList("lore");
            if ((name != null && !name.isEmpty()) || (lore != null && !lore.isEmpty()))
            {
                ItemMeta meta = item.getItemMeta();
                if (name != null && !name.isEmpty())
                {
                    meta.setDisplayName(name);
                }
                if (lore != null && !lore.isEmpty())
                {
                    meta.setLore(lore);
                }
                item.setItemMeta(meta);<commit_msg>Fix lore in GiveItem action<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.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
import com.elmakers.mine.bukkit.api.magic.MagicAPI;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import com.elmakers.mine.bukkit.api.spell.SpellTemplate;
import com.elmakers.mine.bukkit.magic.MagicPlugin;
import com.elmakers.mine.bukkit.utility.ConfigurationUtils;
import com.elmakers.mine.bukkit.utility.InventoryUtils;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.Collection;
import java.util.List;

public class GiveItemAction extends BaseSpellAction
{
    private ItemStack item = null;
    private ItemStack requireItem = null;
    private String permissionNode = null;

    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        MageController controller = context.getController();

        permissionNode = parameters.getString("permission", null);
        String itemKey = parameters.getString("item");
        item = controller.createItem(itemKey);
        if (item == null) {
            context.getLogger().warning("Invalid item: " + itemKey);
        }
        else
        {
            String name = parameters.getString("name", null);
            List<String> lore = ConfigurationUtils.getStringList(parameters, "lore");
            if ((name != null && !name.isEmpty()) || (lore != null && !lore.isEmpty()))
            {
                ItemMeta meta = item.getItemMeta();
                if (name != null && !name.isEmpty())
                {
                    meta.setDisplayName(name);
                }
                if (lore != null && !lore.isEmpty())
                {
                    meta.setLore(lore);
                }
                item.setItemMeta(meta);
{'fraction_non_alphanumeric': 0.1147887323943662, 'fraction_numerical': 0.0, 'mean_word_length': 2.807864164432529, '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': '4155993', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1188, 'n_words': 216}