<commit_before>package io.github.thatsmusic99.headsplus.commands.maincommand;

import io.github.thatsmusic99.headsplus.commands.CommandInfo;
import io.github.thatsmusic99.headsplus.commands.IHeadsPlusCommand;
import io.github.thatsmusic99.headsplus.config.HeadsPlusMessagesManager;
import io.github.thatsmusic99.headsplus.config.customheads.ConfigCustomHeads;
import io.github.thatsmusic99.headsplus.config.defaults.HeadsXEnums;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;

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

@CommandInfo(
        commandname = "restore",
        permission = "headsplus.maincommand.restore",
        maincommand = true,
        usage = "/hp restore <Head Name>",
        descriptionPath = "descriptions.hp.restore"
)
public class RestoreCommand implements IHeadsPlusCommand {

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
        if (args.length > 1) {
            try {
                HeadsXEnums headToBeAdded = HeadsXEnums.valueOf(args[1].toUpperCase());
                // TODO - should be heads.yml
                ConfigCustomHeads.get().set("heads." + headToBeAdded.name, null);
                ConfigCustomHeads.get().addHead(headToBeAdded.texture,
                        true,
                        headToBeAdded.displayName,
                        headToBeAdded.section,
                        "default",
                        true);
                HeadsPlusMessagesManager.get().sendMessage("commands.restore.restored-head", sender, "{head}", args[1]);
                return true;
            } catch (IllegalArgumentException ex) {
                HeadsPlusMessagesManager.get().sendMessage("commands.restore.invalid-head", sender, "{head}", args[1]);
                return true;
            }
        } else {
            HeadsPlusMessagesManager.get().sendMessage("commands.errors.invalid-args", sender);
            return false;
        }
    }
<commit_msg>Make /hp restore use heads.yml<commit_after>package io.github.thatsmusic99.headsplus.commands.maincommand;

import io.github.thatsmusic99.headsplus.commands.CommandInfo;
import io.github.thatsmusic99.headsplus.commands.IHeadsPlusCommand;
import io.github.thatsmusic99.headsplus.config.ConfigHeads;
import io.github.thatsmusic99.headsplus.config.HeadsPlusMessagesManager;
import io.github.thatsmusic99.headsplus.config.customheads.ConfigCustomHeads;
import io.github.thatsmusic99.headsplus.config.defaults.HeadsXEnums;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;

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

@CommandInfo(
        commandname = "restore",
        permission = "headsplus.maincommand.restore",
        maincommand = true,
        usage = "/hp restore <Head Name>",
        descriptionPath = "descriptions.hp.restore"
)
public class RestoreCommand implements IHeadsPlusCommand {

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
        if (args.length > 1) {
            try {
                HeadsXEnums headToBeAdded = HeadsXEnums.valueOf(args[1].toUpperCase());
                ConfigHeads.get().set("heads." + headToBeAdded.name, null);
                ConfigHeads.get().set("heads." + headToBeAdded.name + ".display-name", headToBeAdded.displayName);
                ConfigHeads.get().set("heads." + headToBeAdded.name + ".texture", headToBeAdded.texture);
                HeadsPlusMessagesManager.get().sendMessage("commands.restore.restored-head", sender, "{head}", args[1]);
                return true;
            } catch (IllegalArgumentException ex) {
                HeadsPlusMessagesManager.get().sendMessage("commands.restore.invalid-head", sender, "{head}", args[1]);
                return true;
            }
        } else {
            HeadsPlusMessagesManager.get().sendMessage("commands.errors.invalid-args", sender);
            return false;
        }
    }

{'fraction_non_alphanumeric': 0.10977052282942985, 'fraction_numerical': 0.008043529690087533, 'mean_word_length': 2.914814814814815, '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': '4336980', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1142, 'n_words': 198}