<commit_before>package com.namelessmc.plugin.NamelessSpigot;

import java.io.IOException;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import com.namelessmc.NamelessAPI.NamelessAPI;
import com.namelessmc.plugin.NamelessSpigot.commands.CommandWithArgs;
import com.namelessmc.plugin.NamelessSpigot.commands.GetNotificationsCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.UserInfoCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.NamelessCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.RegisterCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.ReportCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.SetGroupCommand;
import com.namelessmc.plugin.NamelessSpigot.event.PlayerLogin;
import com.namelessmc.plugin.NamelessSpigot.event.PlayerQuit;
import com.namelessmc.plugin.NamelessSpigot.hooks.MVdWPlaceholderUtil;
import com.namelessmc.plugin.NamelessSpigot.hooks.PAPIPlaceholderUtil;

import net.milkbowl.vault.economy.Economy;

public class NamelessPlugin extends JavaPlugin {

	private static NamelessPlugin instance;

	public static URL baseApiURL;

	boolean useGroups = false;
	
	public static final Map<UUID, Long> LOGIN_TIME = new HashMap<>();
	
	public static net.milkbowl.vault.permission.Permission permissions;
	public static Economy economy;
	
	@Override
	public void onEnable() {
		instance = this;
		
		if (getServer().getPluginManager().getPlugin("Vault") == null) {
			log(Level.SEVERE, "This plugin requires Vault. Please install Vault and restart.");
			Bukkit.getPluginManager().disablePlugin(this);
			return;
		}

		RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
		permissions = permissionProvider.getProvider();
		
		if (permissions == null) {
			log(Level.SEVERE, "You do not have a vault-compatible permissions plugin. Please install one and restart.");
			Bukkit.getPluginManager().disablePlugin(this);
			return;
		}
		
		RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
		economy = economyProvider.getProvider();

		try {
			Config.initialize();
		} catch (IOException e) {
			log(Level.SEVERE, "Unable to load config.");
			e.printStackTrace();
			return;
		}
			
		if (!checkConnection()) return;
			
		initHooks();
			
		// Connection is successful, move on with registering listeners and commands.<commit_msg>Check if economy/permission providers are null<commit_after>package com.namelessmc.plugin.NamelessSpigot;

import java.io.IOException;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

import com.namelessmc.NamelessAPI.NamelessAPI;
import com.namelessmc.plugin.NamelessSpigot.commands.CommandWithArgs;
import com.namelessmc.plugin.NamelessSpigot.commands.GetNotificationsCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.UserInfoCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.NamelessCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.RegisterCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.ReportCommand;
import com.namelessmc.plugin.NamelessSpigot.commands.SetGroupCommand;
import com.namelessmc.plugin.NamelessSpigot.event.PlayerLogin;
import com.namelessmc.plugin.NamelessSpigot.event.PlayerQuit;
import com.namelessmc.plugin.NamelessSpigot.hooks.MVdWPlaceholderUtil;
import com.namelessmc.plugin.NamelessSpigot.hooks.PAPIPlaceholderUtil;

import net.milkbowl.vault.economy.Economy;

public class NamelessPlugin extends JavaPlugin {

	private static NamelessPlugin instance;

	public static URL baseApiURL;

	boolean useGroups = false;
	
	public static final Map<UUID, Long> LOGIN_TIME = new HashMap<>();
	
	public static net.milkbowl.vault.permission.Permission permissions;
	public static Economy economy;
	
	@Override
	public void onEnable() {
		instance = this;
		
		if (getServer().getPluginManager().getPlugin("Vault") == null) {
			log(Level.SEVERE, "This plugin requires Vault. Please install Vault and restart.");
			Bukkit.getPluginManager().disablePlugin(this);
			return;
		}

		RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
		if (permissionProvider == null) {
			log(Level.SEVERE, "You do not have a vault-compatible permissions plugin. Please install one and restart.");
			Bukkit.getPluginManager().disablePlugin(this);
			return;
		}
		permissions = permissionProvider.getProvider();
		
		if (permissions == null) {
			log(Level.SEVERE, "You do not have a vault-compatible permissions plugin. Please install one and restart.");
			Bukkit.getPluginManager().disablePlugin(this);
			return;
		}
		
		RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
		if (economyProvider != null) economy = economyProvider.getProvider();

		try {
			Config.initialize();
		} catch (IOException e) {
			log(Level.SEVERE, "Unable to load config.");
			e.printStackTrace();
			return;
		}
			
		if (!checkConnection()) return;
			
		initHooks();
			
		// Connection is successful, move on with registering listeners and commands.
{'fraction_non_alphanumeric': 0.1019537021835495, 'fraction_numerical': 0.0, 'mean_word_length': 5.6798245614035086, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2563751', 'n_tokens_mistral': 1988, 'n_tokens_neox': 1845, 'n_words': 354}