<commit_before>package net.krinsoft.chat;

import com.pneumaticraft.commandhandler.CommandHandler;
import net.krinsoft.chat.api.Target;
import net.krinsoft.chat.commands.*;
import net.krinsoft.chat.listeners.IRCListener;
import net.krinsoft.chat.listeners.PlayerListener;
import net.krinsoft.chat.targets.ChatPlayer;
import net.krinsoft.irc.IRCBot;
import net.krinsoft.irc.InvalidIRCBotException;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;

/**
 * @author krinsdeath (<NAME>)
 */
public class ChatCore extends JavaPlugin {

    // listeners
    private PlayerListener pListener;
    private IRCListener ircListener;

    private ChannelManager channelManager;
    private WorldManager worldManager;
    private PlayerManager playerManager;
    private CommandHandler commandHandler;

    private boolean debug = true;
    private boolean allow_channels = true;
    private boolean allow_whispers = true;
    private boolean allow_afk = true;

    @Override
    public void onEnable() {
        long time = System.nanoTime();
        initConfiguration();
        initEvents();
        time = System.nanoTime() - time;
        log("v" + getDescription().getVersion() + " enabled in " + (time / 1000000L) + "ms. (" + time + "ns)");
    }

    @Override
    public void onDisable() {
        long time = System.nanoTime();
        pListener = null;
        playerManager.clean();
        playerManager.saveConfig();
        channelManager.clean();
        channelManager.saveConfig();
        worldManager.clean();
        if (irc_bot != null) { irc_bot.clean(); }
        time = System.nanoTime() - time;
        log("v" + getDescription().getVersion() + " disabled in " + (time / 1000000L) + "ms. (" + time + "ns)");
    }

    @Override
    public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
        if (!isEnabled()) {
            cs.sendMessage(ChatColor.RED + "no.");
            return true;
        }
        ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));
        allArgs.add(0, label);
        return this.commandHandler.locateAndRunCommand(cs, allArgs);
    }

    public void initConfiguration() {
        configuration = null;
        registerConfiguration();
        registerGroups();<commit_msg>Added tab complete overriding for invisible players.<commit_after>package net.krinsoft.chat;

import com.pneumaticraft.commandhandler.CommandHandler;
import net.krinsoft.chat.api.Target;
import net.krinsoft.chat.commands.AfkCommand;
import net.krinsoft.chat.commands.BaseCommand;
import net.krinsoft.chat.commands.ChannelAdminCommand;
import net.krinsoft.chat.commands.ChannelBootCommand;
import net.krinsoft.chat.commands.ChannelCreateCommand;
import net.krinsoft.chat.commands.ChannelInfoCommand;
import net.krinsoft.chat.commands.ChannelInviteCommand;
import net.krinsoft.chat.commands.ChannelJoinCommand;
import net.krinsoft.chat.commands.ChannelListCommand;
import net.krinsoft.chat.commands.ChannelMessageCommand;
import net.krinsoft.chat.commands.ChannelPartCommand;
import net.krinsoft.chat.commands.ChannelSetCommand;
import net.krinsoft.chat.commands.DebugCommand;
import net.krinsoft.chat.commands.GroupOptionCommand;
import net.krinsoft.chat.commands.IRCCommand;
import net.krinsoft.chat.commands.IRCConnectCommand;
import net.krinsoft.chat.commands.IRCCreateCommand;
import net.krinsoft.chat.commands.IRCListCommand;
import net.krinsoft.chat.commands.IRCQuitCommand;
import net.krinsoft.chat.commands.MuteCommand;
import net.krinsoft.chat.commands.NickCommand;
import net.krinsoft.chat.commands.ReloadCommand;
import net.krinsoft.chat.commands.ReplyCommand;
import net.krinsoft.chat.commands.TargetCommand;
import net.krinsoft.chat.commands.UserIgnoreCommand;
import net.krinsoft.chat.commands.UserInfoCommand;
import net.krinsoft.chat.commands.UserPrefixCommand;
import net.krinsoft.chat.commands.UserSuffixCommand;
import net.krinsoft.chat.commands.ValidateGroupsCommand;
import net.krinsoft.chat.commands.VersionCommand;
import net.krinsoft.chat.commands.WhisperCommand;
import net.krinsoft.chat.listeners.IRCListener;
import net.krinsoft.chat.listeners.PlayerListener;
import net.krinsoft.chat.targets.ChatPlayer;
import net.krinsoft.irc.IRCBot;
import net.krinsoft.irc.InvalidIRCBotException;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

/**
 * @author krinsdeath (<NAME>)
 */
public class ChatCore extends JavaPlugin {

    // listeners
    private PlayerListener pListener;
    private IRCListener ircListener;

    private ChannelManager channelManager;
    private WorldManager worldManager;
    private PlayerManager playerManager;
    private CommandHandler commandHandler;

    private boolean debug = true;
    private boolean allow_channels = true;
    private boolean allow_whispers = true;
    private boolean allow_afk = true;

    @Override
    public void onEnable() {
        long time = System.nanoTime();
        initConfiguration();
        initEvents();
        time = System.nanoTime() - time;
        log("v" + getDescription().getVersion() + " enabled in " + (time / 1000000L) + "ms. (" + time + "ns)");
    }

    @Override
    public void onDisable() {
        long time = System.nanoTime();
        pListener = null;
        playerManager.clean();
        playerManager.saveConfig();
        channelManager.clean();
        channelManager.saveConfig();
        worldManager.clean();
        if (irc_bot != null) { irc_bot.clean(); }
        time = System.nanoTime() - time;
        log("v" + getDescription().getVersion() + " disabled in " + (time / 1000000L) + "ms. (" + time + "ns)");
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        List<String> tabbed = new ArrayList<String>();
        if (command.getName().equals("target") || command.getName().equals("whisper")) {
            if (!(sender instanceof Player)) {
                return null;
            }
            Player tabber = (Player) sender;
            String toComplete = args[args.length - 1];
            for (Player player : getServer().getOnlinePlayers()) {
                if (tabber.canSee(player) && player.getName().startsWith(toComplete)) {
                    tabbed.add(player.getName());
                }
            }
            return tabbed;
        }
        return null;
    }

    @Override
    public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
        if (!isEnabled()) {
            cs.sendMessage(ChatColor.RED + "no.");
            return true;
        }
        List<String> allArgs = new ArrayList<String>(Arrays.asList(args));
        allArgs.add(0, label);
        return this.commandHandler.locateAndRunCommand(cs, allArgs);
    }

    public void initConfiguration() {
        configuration = null;
        registerConfiguration();
        registerGroups();
{'fraction_non_alphanumeric': 0.11029690461149716, 'fraction_numerical': 0.003916614024005054, 'mean_word_length': 3.60500290866783, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '3511858', 'n_tokens_mistral': 2315, 'n_tokens_neox': 2238, 'n_words': 459}