<commit_before>package me.SimplyBallistic.JoinVerify;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;

import me.SimplyBallistic.JoinVerify.events.InventoryListener;
import me.SimplyBallistic.JoinVerify.events.JoinListener;
import me.SimplyBallistic.JoinVerify.inventory.Tester;
import me.dommi2212.BungeeBridge.packets.PacketCustom;

/**
 * 
 * @author ryan9_000
 *
 */
public class JoinVerify extends JavaPlugin implements PluginMessageListener{
	public static JoinVerify instance;
	public BukkitPlayersFile verified;
	public static boolean verifyAll;
	public static boolean useBungee;
	public List<Player> verifying;
	@Override
	public void onEnable() {
		getLogger().info("Starting up...");
		
		saveDefaultConfig();
		
		verifyAll=getConfig().getBoolean("verify-all",false);
		useBungee=getConfig().getBoolean("use-bungee", false);
		
		
		
		if(useBungee&&!Bukkit.getPluginManager().isPluginEnabled("BungeeBridgeC")){
			getLogger().warning("Use bungee was set to true in the config and BungeeBridge is not installed! Disabling...");
			getPluginLoader().disablePlugin(this);
			return;
		}
		
		instance=this;
		verified=new BukkitPlayersFile();
		verifying=new ArrayList<>();
		getCommand("jverify").setExecutor(new VerifyCommand());
		Bukkit.getPluginManager().registerEvents(new InventoryListener(), this);
		Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
		if(useBungee){
		getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
	    getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
	    
		}
		reloadConfig();
		
		
	}
	@Override
	public void reloadConfig(){
		saveDefaultConfig();
		super.reloadConfig();
		List<String> blocks = null;
		try{
			blocks=getConfig().getStringList("blocks");
			for(int i=0;i<blocks.size();){
				String s=blocks.get(i);
				try{Material.valueOf(s.replaceAll(" ", "_").toUpperCase());}catch(Exception e){
					getLogger().warning(s+" isn't a valid block! Removing from list...");
					blocks.remove(i);
					continue;
				}
				i++;
			}
			
			}catch(Exception e){
				getLogger().warning("Could not find 'blocks' list in config! Resulting to random blocks...");
			}
		finally{
			getConfig().set("blocks", blocks);
		}
	}
	
	 @Override
	 @Deprecated<commit_msg>Make config save when checking blocks user has given<commit_after>package me.SimplyBallistic.JoinVerify;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;

import me.SimplyBallistic.JoinVerify.events.InventoryListener;
import me.SimplyBallistic.JoinVerify.events.JoinListener;
import me.SimplyBallistic.JoinVerify.inventory.Tester;
import me.dommi2212.BungeeBridge.packets.PacketCustom;

/**
 * 
 * @author ryan9_000
 *
 */
public class JoinVerify extends JavaPlugin implements PluginMessageListener{
	public static JoinVerify instance;
	public BukkitPlayersFile verified;
	public static boolean verifyAll;
	public static boolean useBungee;
	public List<Player> verifying;
	@Override
	public void onEnable() {
		getLogger().info("Starting up...");
		
		saveDefaultConfig();
		
		verifyAll=getConfig().getBoolean("verify-all",false);
		useBungee=getConfig().getBoolean("use-bungee", false);
		
		
		
		if(useBungee&&!Bukkit.getPluginManager().isPluginEnabled("BungeeBridgeC")){
			getLogger().warning("Use bungee was set to true in the config and BungeeBridge is not installed! Disabling...");
			getPluginLoader().disablePlugin(this);
			return;
		}
		
		instance=this;
		verified=new BukkitPlayersFile();
		verifying=new ArrayList<>();
		getCommand("jverify").setExecutor(new VerifyCommand());
		Bukkit.getPluginManager().registerEvents(new InventoryListener(), this);
		Bukkit.getPluginManager().registerEvents(new JoinListener(), this);
		if(useBungee){
		getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
	    getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
	    
		}
		reloadConfig();
		
		
	}
	@Override
	public void reloadConfig(){
		saveDefaultConfig();
		super.reloadConfig();
		List<String> blocks = null;
		try{
			blocks=getConfig().getStringList("blocks");
			for(int i=0;i<blocks.size();){
				String s=blocks.get(i);
				try{Material.valueOf(s.replaceAll(" ", "_").toUpperCase());}catch(Exception e){
					getLogger().warning(s+" isn't a valid block! Removing from list...");
					blocks.remove(i);
					continue;
				}
				i++;
			}
			
			}catch(Exception e){
				getLogger().warning("Could not find 'blocks' list in config! Resulting to random blocks...");
			}
		finally{
			getConfig().set("blocks", blocks);
			saveConfig();
		}
	}
	
	 @Override
	 @Deprecated
{'fraction_non_alphanumeric': 0.131704628949302, 'fraction_numerical': 0.0033063923585598823, 'mean_word_length': 5.083798882681564, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '3400281', 'n_tokens_mistral': 1918, 'n_tokens_neox': 1679, 'n_words': 324}