<commit_before>package com.github.nthportal.uhc.commands;

import com.github.nthportal.uhc.core.Config;
import com.github.nthportal.uhc.UHCPlugin;
import com.google.common.base.Joiner;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import java.util.*;

public class ConfCommandExecutor implements CommandExecutor {
    public static final String NAME = "uhc-conf";
    public static final String PERMISSION = "uhc-plugin.uhc-conf";

    private static final int PAGE_ENTRIES = 8;

    private final UHCPlugin plugin;

    public ConfCommandExecutor(UHCPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String label, String[] strings) {
        if ((strings.length == 0) || !commandSender.hasPermission(PERMISSION)) {
            return false;
        }

        switch (strings[0].toLowerCase()) {
            case Opts.RELOAD:
                plugin.reloadConfig();
                commandSender.sendMessage("Reloaded configuration from file");
                break;
            case Opts.HELP:
                commandSender.sendMessage("Help message placeholder"); // TODO replace with actual help message
                break;
            case Opts.ON:
                return onEventCommand(commandSender, Arrays.copyOfRange(strings, 1, strings.length));
            default:
                commandSender.sendMessage("Invalid sub-command: " + strings[0]);
                return false;
        }
        return true;
    }

    private boolean onEventCommand(CommandSender commandSender, String[] args) {
        if (args.length < 2) {
            commandSender.sendMessage("Insufficient arguments for sub-command: " + Opts.ON);
            return false;
        }

        String event = args[0].toLowerCase();
        if (!Events.map.containsKey(event)) {
            commandSender.sendMessage("Invalid sub-command: " + args[0]);
            return false;
        }
        String onEvent = Events.map.get(event);

        switch (args[1].toLowerCase()) {
            case Opts.ADD:
                return doAdd(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.REMOVE:
                return doRemove(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.CLEAR:
                return doClear(commandSender, onEvent);
            case Opts.LIST:
                return doList(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.MOVE:
                return doMove(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            default:
                commandSender.sendMessage("Invalid sub-command: " + args[0]);
                return false;
        }
    }

    private boolean doAdd(CommandSender commandSender, String event, String[] args) {
        if (args.length < 2) {
            commandSender.sendMessage("Insufficient arguments for sub-command: " + Opts.ADD);<commit_msg>Fixed typo.<commit_after>package com.github.nthportal.uhc.commands;

import com.github.nthportal.uhc.core.Config;
import com.github.nthportal.uhc.UHCPlugin;
import com.google.common.base.Joiner;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import java.util.*;

public class ConfCommandExecutor implements CommandExecutor {
    public static final String NAME = "uhc-conf";
    public static final String PERMISSION = "uhc-plugin.uhc-conf";

    private static final int PAGE_ENTRIES = 8;

    private final UHCPlugin plugin;

    public ConfCommandExecutor(UHCPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String label, String[] strings) {
        if ((strings.length == 0) || !commandSender.hasPermission(PERMISSION)) {
            return false;
        }

        switch (strings[0].toLowerCase()) {
            case Opts.RELOAD:
                plugin.reloadConfig();
                commandSender.sendMessage("Reloaded configuration from file");
                break;
            case Opts.HELP:
                commandSender.sendMessage("Help message placeholder"); // TODO replace with actual help message
                break;
            case Opts.ON:
                return onEventCommand(commandSender, Arrays.copyOfRange(strings, 1, strings.length));
            default:
                commandSender.sendMessage("Invalid sub-command: " + strings[0]);
                return false;
        }
        return true;
    }

    private boolean onEventCommand(CommandSender commandSender, String[] args) {
        if (args.length < 2) {
            commandSender.sendMessage("Insufficient arguments for sub-command: " + Opts.ON);
            return false;
        }

        String event = args[0].toLowerCase();
        if (!Events.map.containsKey(event)) {
            commandSender.sendMessage("Invalid sub-command: " + args[0]);
            return false;
        }
        String onEvent = Events.map.get(event);

        switch (args[1].toLowerCase()) {
            case Opts.ADD:
                return doAdd(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.REMOVE:
                return doRemove(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.CLEAR:
                return doClear(commandSender, onEvent);
            case Opts.LIST:
                return doList(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            case Opts.MOVE:
                return doMove(commandSender, onEvent, Arrays.copyOfRange(args, 2, args.length));
            default:
                commandSender.sendMessage("Invalid sub-command: " + args[1]);
                return false;
        }
    }

    private boolean doAdd(CommandSender commandSender, String event, String[] args) {
        if (args.length < 2) {
            commandSender.sendMessage("Insufficient arguments for sub-command: " + Opts.ADD);
{'fraction_non_alphanumeric': 0.10003242542153049, 'fraction_numerical': 0.0048638132295719845, 'mean_word_length': 2.3400108283703305, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7661944', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1622, 'n_words': 384}