<commit_before>package info.faceland.loot.utils.inventory;

import com.tealcube.minecraft.bukkit.TextUtils;
import info.faceland.loot.api.managers.SocketGemManager;
import info.faceland.loot.api.sockets.SocketGem;
import io.pixeloutlaw.minecraft.spigot.hilt.HiltItemStack;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class GemUtil {

    private GemUtil() {
        // do nothing
    }

    public static Set<SocketGem> getGems(SocketGemManager manager, ItemStack itemStack) {
        if (itemStack == null || itemStack.getType() == Material.AIR) {
            return new HashSet<>();
        }
        Set<SocketGem> gems = new HashSet<>();
        HiltItemStack item = new HiltItemStack(itemStack);
        List<String> lore = item.getLore();
        List<String> strippedLore = new ArrayList<>();
        for (String s : lore) {
            strippedLore.add(ChatColor.stripColor(s));
        }
        for (String key : strippedLore) {
            SocketGem gem = manager.getSocketGem(key);
            if (gem == null) {
                for (SocketGem g : manager.getSocketGems()) {
                    if (key.equals(ChatColor.stripColor(TextUtils.color(
                            g.getTriggerText() != null ? g.getTriggerText() : "")))) {
                        gem = g;
                        break;
                    }
                }
                if (gem == null) {
                    continue;
                }
            }
            gems.add(gem);
        }
        return gems;
    }

}<commit_msg>Implementing isTriggerable<commit_after>package info.faceland.loot.utils.inventory;

import com.tealcube.minecraft.bukkit.TextUtils;
import info.faceland.loot.api.managers.SocketGemManager;
import info.faceland.loot.api.sockets.SocketGem;
import io.pixeloutlaw.minecraft.spigot.hilt.HiltItemStack;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class GemUtil {

    private GemUtil() {
        // do nothing
    }

    public static Set<SocketGem> getGems(SocketGemManager manager, ItemStack itemStack) {
        if (itemStack == null || itemStack.getType() == Material.AIR) {
            return new HashSet<>();
        }
        Set<SocketGem> gems = new HashSet<>();
        HiltItemStack item = new HiltItemStack(itemStack);
        List<String> lore = item.getLore();
        List<String> strippedLore = new ArrayList<>();
        for (String s : lore) {
            strippedLore.add(ChatColor.stripColor(s));
        }
        for (String key : strippedLore) {
            SocketGem gem = manager.getSocketGem(key);
            if (gem == null) {
                for (SocketGem g : manager.getSocketGems()) {
                    if (!g.isTriggerable()) {
                        continue;
                    }
                    if (key.equals(ChatColor.stripColor(TextUtils.color(
                            g.getTriggerText() != null ? g.getTriggerText() : "")))) {
                        gem = g;
                        break;
                    }
                }
                if (gem == null) {
                    continue;
                }
            }
            gems.add(gem);
        }
        return gems;
    }

}
{'fraction_non_alphanumeric': 0.11117462132037725, 'fraction_numerical': 0.0, 'mean_word_length': 1.8548123980424143, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4553978', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1004, 'n_words': 196}