<commit_before>package info.faceland.loot.sockets;

import info.faceland.hilt.HiltItemStack;
import info.faceland.loot.api.groups.ItemGroup;
import info.faceland.loot.api.sockets.SocketGem;
import info.faceland.loot.api.sockets.effects.SocketEffect;
import org.bukkit.ChatColor;
import org.bukkit.Material;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class LootSocketGem implements SocketGem {

    private final String name;
    private double weight;
    private double distanceWeight;
    private String prefix;
    private String suffix;
    private List<String> lore;
    private List<SocketEffect> socketEffects;
    private List<ItemGroup> itemGroups;
    private boolean broadcast;
    private boolean triggerable;

    public LootSocketGem(String name) {
        this.name = name;
        this.lore = new ArrayList<>();
        this.socketEffects = new ArrayList<>();
        this.itemGroups = new ArrayList<>();
    }

    @Override
    public int hashCode() {
        return name != null ? name.hashCode() : 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        LootSocketGem that = (LootSocketGem) o;

        return !(name != null ? !name.equals(that.name) : that.name != null);
    }

    @Override
    public String getName() {
        return name;
    }


    @Override
    public double getWeight() {
        return weight;
    }

    @Override
    public String getPrefix() {
        return prefix;
    }

    @Override
    public String getSuffix() {
        return suffix;
    }

    @Override
    public List<String> getLore() {
        return new ArrayList<>(lore);
    }

    @Override
    public List<SocketEffect> getSocketEffects() {
        return new ArrayList<>(socketEffects);
    }

    @Override
    public List<ItemGroup> getItemGroups() {
        return itemGroups;
    }

    @Override
    public HiltItemStack toItemStack(int amount) {
        HiltItemStack itemStack = new HiltItemStack(Material.EMERALD);
        itemStack.setName(ChatColor.GOLD + "Socket Gem - " + getName());
        itemStack.setAmount(amount);
        List<String> lore = Arrays.asList(ChatColor.DARK_GRAY + "(" + ChatColor.GRAY
                                          + (itemGroups.isEmpty() ? itemGroupsToString() :
                                             "ANY") + ChatColor.DARK_GRAY + ")",
                                          ChatColor.GRAY + "Drop this gem on an item with an",
                                          ChatColor.GRAY + "open " + ChatColor.GOLD + "(Socket) " + ChatColor.GRAY +
                                          "to use it.");
        lore.addAll(getLore());
        itemStack.setLore(lore);
        return itemStack;
    }

    private String itemGroupsToString() {
        StringBuilder sb = new StringBuilder();
        for (ItemGroup ig :  getItemGroups()) {
            sb.append(ig.getName()).append(" ");
        }
        return sb.toString().trim();
    }

    void setSocketEffects(List<SocketEffect> socketEffects) {
        this.socketEffects = socketEffects;
    }

    void setLore(List<String> lore) {<commit_msg>fixing issue with socket gem lore<commit_after>package info.faceland.loot.sockets;

import info.faceland.hilt.HiltItemStack;
import info.faceland.loot.api.groups.ItemGroup;
import info.faceland.loot.api.sockets.SocketGem;
import info.faceland.loot.api.sockets.effects.SocketEffect;
import org.bukkit.ChatColor;
import org.bukkit.Material;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public final class LootSocketGem implements SocketGem {

    private final String name;
    private double weight;
    private double distanceWeight;
    private String prefix;
    private String suffix;
    private List<String> lore;
    private List<SocketEffect> socketEffects;
    private List<ItemGroup> itemGroups;
    private boolean broadcast;
    private boolean triggerable;

    public LootSocketGem(String name) {
        this.name = name;
        this.lore = new ArrayList<>();
        this.socketEffects = new ArrayList<>();
        this.itemGroups = new ArrayList<>();
    }

    @Override
    public int hashCode() {
        return name != null ? name.hashCode() : 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        LootSocketGem that = (LootSocketGem) o;

        return !(name != null ? !name.equals(that.name) : that.name != null);
    }

    @Override
    public String getName() {
        return name;
    }


    @Override
    public double getWeight() {
        return weight;
    }

    @Override
    public String getPrefix() {
        return prefix;
    }

    @Override
    public String getSuffix() {
        return suffix;
    }

    @Override
    public List<String> getLore() {
        return new ArrayList<>(lore);
    }

    @Override
    public List<SocketEffect> getSocketEffects() {
        return new ArrayList<>(socketEffects);
    }

    @Override
    public List<ItemGroup> getItemGroups() {
        return itemGroups;
    }

    @Override
    public HiltItemStack toItemStack(int amount) {
        HiltItemStack itemStack = new HiltItemStack(Material.EMERALD);
        itemStack.setName(ChatColor.GOLD + "Socket Gem - " + getName());
        itemStack.setAmount(amount);
        List<String> lore = new ArrayList<>();
        Collections.addAll(lore, ChatColor.DARK_GRAY + "(" + ChatColor.GRAY
                                 + (itemGroups.isEmpty() ? itemGroupsToString() :
                                    "ANY") + ChatColor.DARK_GRAY + ")",
                           ChatColor.GRAY + "Drop this gem on an item with an",
                           ChatColor.GRAY + "open " + ChatColor.GOLD + "(Socket) " + ChatColor.GRAY +
                           "to use it.");
        lore.addAll(getLore());
        itemStack.setLore(lore);
        return itemStack;
    }

    private String itemGroupsToString() {
        StringBuilder sb = new StringBuilder();
        for (ItemGroup ig :  getItemGroups()) {
            sb.append(ig.getName()).append(" ");
        }
        return sb.toString().trim();
    }

    void setSocketEffects(List<SocketEffect> socketEffects) {
        this.socketEffects = socketEffects;
    }

    void setLore(List<String> lore) {
{'fraction_non_alphanumeric': 0.1062215477996965, 'fraction_numerical': 0.00030349013657056146, 'mean_word_length': 2.193313953488372, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '12966', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1829, 'n_words': 440}