<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nz.co.lolnet.james137137.FactionChat.API;

import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import nz.co.lolnet.james137137.FactionChat.API.chat.ChatFilter;
import nz.co.lolnet.james137137.FactionChat.ChatMode;
import nz.co.lolnet.james137137.FactionChat.FactionChat;
import nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.PrefixAndSuffix;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

/**
 *
 * @author James
 */
public class FactionChatAPI {

    public static HashSet<ChatFilter> chatFilter = new HashSet<>();
    private static FactionChat factionChat;
    private static boolean IncludePrefix;
    private static boolean IncludeSuffix;
    public static PrefixAndSuffix prefixAndSuffix = null;

    public void setupAPI(FactionChat plugin) {
        factionChat = plugin;
        IncludePrefix = plugin.getConfig().getBoolean("FactionChatMessage.IncludePrefix");
        IncludeSuffix = plugin.getConfig().getBoolean("FactionChatMessage.IncludeSuffix");
        setupPreSuffixPlugin(plugin);
    }

    private void setupPreSuffixPlugin(FactionChat plugin) {
        Plugin myPlugin = plugin.getServer().getPluginManager().getPlugin("GroupManager");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.GroupManager").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        myPlugin = plugin.getServer().getPluginManager().getPlugin("bPermissions");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.BPermissions").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        myPlugin = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.PermissionsEX").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        if (prefixAndSuffix == null) {
            myPlugin = plugin.getServer().getPluginManager().getPlugin("Vault");
            if (myPlugin != null && myPlugin.isEnabled()) {
                try {
                    prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.VaultChat").getConstructor().newInstance();
                    prefixAndSuffix.init();
                } catch (Exception ex) {
                    IncludePrefix = false;
                    IncludeSuffix = false;
                    Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
                }
                return;
            }

        }
        if (prefixAndSuffix == null) {<commit_msg>removed erroring on Vaults<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nz.co.lolnet.james137137.FactionChat.API;

import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import nz.co.lolnet.james137137.FactionChat.API.chat.ChatFilter;
import nz.co.lolnet.james137137.FactionChat.ChatMode;
import nz.co.lolnet.james137137.FactionChat.FactionChat;
import nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.PrefixAndSuffix;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

/**
 *
 * @author James
 */
public class FactionChatAPI {

    public static HashSet<ChatFilter> chatFilter = new HashSet<>();
    private static FactionChat factionChat;
    private static boolean IncludePrefix;
    private static boolean IncludeSuffix;
    public static PrefixAndSuffix prefixAndSuffix = null;

    public void setupAPI(FactionChat plugin) {
        factionChat = plugin;
        IncludePrefix = plugin.getConfig().getBoolean("FactionChatMessage.IncludePrefix");
        IncludeSuffix = plugin.getConfig().getBoolean("FactionChatMessage.IncludeSuffix");
        setupPreSuffixPlugin(plugin);
    }

    private void setupPreSuffixPlugin(FactionChat plugin) {
        Plugin myPlugin = plugin.getServer().getPluginManager().getPlugin("GroupManager");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.GroupManager").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        myPlugin = plugin.getServer().getPluginManager().getPlugin("bPermissions");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.BPermissions").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        myPlugin = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
        if (myPlugin != null && myPlugin.isEnabled()) {
            try {
                prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.PermissionsEX").getConstructor().newInstance();
                prefixAndSuffix.init();
            } catch (Exception ex) {
                IncludePrefix = false;
                IncludeSuffix = false;
                Logger.getLogger(FactionChatAPI.class.getName()).log(Level.SEVERE, null, ex);
            }
            return;
        }
        if (prefixAndSuffix == null) {
            myPlugin = plugin.getServer().getPluginManager().getPlugin("Vault");
            if (myPlugin != null && myPlugin.isEnabled()) {
                try {
                    prefixAndSuffix = (PrefixAndSuffix) Class.forName("nz.co.lolnet.james137137.FactionChat.PrefixAndSuffix.VaultChat").getConstructor().newInstance();
                    prefixAndSuffix.init();
                } catch (Exception ex) {
                    IncludePrefix = false;
                    IncludeSuffix = false;
                }
                return;
            }

        }
        if (prefixAndSuffix == null) {
{'fraction_non_alphanumeric': 0.10959968907889624, 'fraction_numerical': 0.013991449669646328, 'mean_word_length': 2.449508489722967, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3230478', 'n_tokens_mistral': 2276, 'n_tokens_neox': 2113, 'n_words': 350}