<commit_before>package me.st28.flexseries.flexcore.commands.items;

import me.st28.flexseries.flexcore.FlexCore;
import me.st28.flexseries.flexcore.commands.FlexCommand;
import me.st28.flexseries.flexcore.commands.FlexCommandSettings;
import me.st28.flexseries.flexcore.commands.exceptions.CommandInterruptedException;
import me.st28.flexseries.flexcore.items.ItemNameIndex;
import me.st28.flexseries.flexcore.lists.ListBuilder;
import me.st28.flexseries.flexcore.messages.MessageReference;
import me.st28.flexseries.flexcore.permissions.PermissionNodes;
import me.st28.flexseries.flexcore.plugins.FlexPlugin;
import me.st28.flexseries.flexcore.plugins.exceptions.ModuleDisabledException;
import me.st28.flexseries.flexcore.utils.StringUtils;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public final class CmdItemInfo extends FlexCommand<FlexCore> {

    public CmdItemInfo(FlexCore plugin) {
        super(
                plugin,
                "flexitemdb",
                new FlexCommandSettings<FlexCore>()
                    .permission(PermissionNodes.ITEM_INFO)
                    .setPlayerOnly()
        );
    }

    @Override
    public void runCommand(CommandSender sender, String command, String label, String[] args, Map<String, String> parameters) {
        ItemStack item = ((Player) sender).getItemInHand();

        if (item == null) {
            throw new CommandInterruptedException(MessageReference.create(FlexCore.class, "errors.must_hold_item"));
        }

        Material type = item.getType();
        List<String> aliases = new ArrayList<>();
        try {
            aliases.addAll(FlexPlugin.getRegisteredModule(ItemNameIndex.class).getAliases(type));
        } catch (ModuleDisabledException ex) { }

        ListBuilder builder = new ListBuilder("title", "Item Info", null, label);

        builder.addMessage("title", "Type", type.toString() + ":" + item.getDurability());
        if (!aliases.isEmpty()) {
            builder.addMessage("title", "Aliases", StringUtils.stringCollectionToString(aliases, ", "));
        }

        builder.sendTo(sender, 1);
    }

}<commit_msg>Now uses MaterialRef<commit_after>package me.st28.flexseries.flexcore.commands.items;

import me.st28.flexseries.flexcore.FlexCore;
import me.st28.flexseries.flexcore.commands.FlexCommand;
import me.st28.flexseries.flexcore.commands.FlexCommandSettings;
import me.st28.flexseries.flexcore.commands.FlexHelpCommand;
import me.st28.flexseries.flexcore.commands.exceptions.CommandInterruptedException;
import me.st28.flexseries.flexcore.items.ItemNameIndex;
import me.st28.flexseries.flexcore.lists.ListBuilder;
import me.st28.flexseries.flexcore.messages.MessageReference;
import me.st28.flexseries.flexcore.permissions.PermissionNodes;
import me.st28.flexseries.flexcore.plugins.FlexPlugin;
import me.st28.flexseries.flexcore.plugins.exceptions.ModuleDisabledException;
import me.st28.flexseries.flexcore.utils.MaterialRef;
import me.st28.flexseries.flexcore.utils.StringUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public final class CmdItemInfo extends FlexCommand<FlexCore> {

    public CmdItemInfo(FlexCore plugin) {
        super(
                plugin,
                "flexiteminfo",
                new FlexCommandSettings<FlexCore>()
                    .permission(PermissionNodes.ITEM_INFO)
                    .setPlayerOnly()
                    .helpPath("FlexCore.ItemInfo")
        );

        registerSubcommand(new FlexHelpCommand<>(plugin, this));
    }

    @Override
    public void runCommand(CommandSender sender, String command, String label, String[] args, Map<String, String> parameters) {
        ItemStack item = ((Player) sender).getItemInHand();

        if (item == null) {
            throw new CommandInterruptedException(MessageReference.create(FlexCore.class, "errors.must_hold_item"));
        }

        MaterialRef type = new MaterialRef(item);
        List<String> aliases = new ArrayList<>();
        try {
            aliases.addAll(FlexPlugin.getRegisteredModule(ItemNameIndex.class).getAliases(type));
        } catch (ModuleDisabledException ex) { }

        ListBuilder builder = new ListBuilder("title", "Item Info", null, label);

        builder.addMessage("title", "Type", type.toString());
        if (!aliases.isEmpty()) {
            builder.addMessage("title", "Aliases", StringUtils.stringCollectionToString(aliases, ", "));
        }

        builder.sendTo(sender, 1);
    }

}
{'fraction_non_alphanumeric': 0.1110180142438207, 'fraction_numerical': 0.011311269375785506, 'mean_word_length': 3.595765158806545, 'pattern_counts': {'":': 1, '<': 14, '<?xml version=': 0, '>': 14, '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': '6962949', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1336, 'n_words': 228}