<commit_before>package info.tregmine.chestbless;


//import org.bukkit.ChatColor;
//import org.bukkit.Location;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
//import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;

public class BlessPlayer extends PlayerListener {
	private final Bless plugin;

	public BlessPlayer(Bless instance) {
		this.plugin = instance;
		plugin.getServer();
	}

	public void onPlayerInteract(PlayerInteractEvent event) {
		Player player = event.getPlayer();
		Block block = event.getClickedBlock();
		info.tregmine.api.TregminePlayer tregminePlayer = this.plugin.tregmine.tregminePlayer.get(player.getName());

		if ((event.getAction() == Action.RIGHT_CLICK_BLOCK  || event.getAction() == Action.LEFT_CLICK_BLOCK) && 
				(		block.getType() == Material.CHEST || 
						block.getType() == Material.FURNACE ||
						block.getType() == Material.BURNING_FURNACE ||
						block.getType() == Material.WOOD_DOOR ||
						block.getType() == Material.WOODEN_DOOR ||
						block.getType() == Material.LEVER ||
						block.getType() == Material.STONE_BUTTON ||
						block.getType() == Material.STONE_PLATE ||
						block.getType() == Material.WOOD_PLATE ||
						block.getType() == Material.WORKBENCH ||
						block.getType() == Material.SIGN_POST ||
						block.getType() == Material.DIODE ||
						block.getType() == Material.DIODE_BLOCK_OFF ||
						block.getType() == Material.DIODE_BLOCK_ON ||
						block.getType() == Material.JUKEBOX ||
						block.getType() == Material.SIGN)	
				) {
			Location loc = block.getLocation();
 			int checksum = (loc.getBlockX() + "," + loc.getBlockZ() +"," + loc.getWorld().getName()).hashCode();
			int newchecksum = (loc.getBlockX() + "," + loc.getBlockZ() + "," + loc.getBlockY() + "," + loc.getWorld().getName()).hashCode();
			
			if (this.plugin.chests.containsKey(checksum)) {
				
				String name = this.plugin.chests.get(checksum);
				player.sendMessage(ChatColor.AQUA + "You reblessed a block for " + name + ".");
				this.plugin.chests.put(newchecksum, name);
				this.plugin.chests.remove(checksum);
				info.tregmine.database.Mysql mysql = new info.tregmine.database.Mysql();
				mysql.connect();

				info.tregmine.chestbless.Store.savebless(newchecksum, name, player.getWorld().getName(), mysql);
				info.tregmine.chestbless.Store.deletebless(checksum, name, player.getWorld().getName(), mysql);
				mysql.close();

			}

		}

		
		if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.BONE && (tregminePlayer.isAdmin() || tregminePlayer.getMetaBoolean("bless") &&
				(		block.getType() == Material.CHEST || 
				block.getType() == Material.FURNACE ||
				block.getType() == Material.BURNING_FURNACE ||
				block.getType() == Material.WOOD_DOOR ||
				block.getType() == Material.WOODEN_DOOR ||
				block.getType() == Material.LEVER ||
				block.getType() == Material.STONE_BUTTON ||
				block.getType() == Material.STONE_PLATE ||
				block.getType() == Material.WOOD_PLATE ||
				block.getType() == Material.WORKBENCH ||
				block.getType() == Material.DIODE ||
				block.getType() == Material.DIODE_BLOCK_OFF ||
				block.getType() == Material.DIODE_BLOCK_ON ||
				block.getType() == Material.SIGN_POST ||
				block.getType() == Material.JUKEBOX ||
				block.getType() == Material.SIGN)	
				)) {
			Location loc = block.getLocation();
			int checksum = (loc.getBlockX() + "," + loc.getBlockZ() + "," + loc.getBlockY() + "," + loc.getWorld().getName()).hashCode();
			
			String name = tregminePlayer.getMetaString("chestbless");
			this.plugin.getServer().getPlayer(name).sendMessage(ChatColor.AQUA + "Your god blessed in your name!");
			player.sendMessage(ChatColor.AQUA + "You blessed for " + name + ".");
			this.plugin.chests.put(checksum, name);
			info.tregmine.database.Mysql mysql = new info.tregmine.database.Mysql();
			mysql.connect();
			info.tregmine.chestbless.Store.savebless(checksum, name, player.getWorld().getName(), mysql);
			this.plugin.log.info(player.getName() + " Blessed a block " + checksum + " to " + name + ".");
			mysql.close();

			event.setCancelled(true);
			return;
		}


		if ((event.getAction() == Action.RIGHT_CLICK_BLOCK  || event.getAction() == Action.LEFT_CLICK_BLOCK) && 
				(		block.getType() == Material.CHEST || 
				block.getType() == Material.FURNACE ||
				block.getType() == Material.BURNING_FURNACE ||
				block.getType() == Material.WOOD_DOOR ||
				block.getType() == Material.WOODEN_DOOR ||
				block.getType() == Material.LEVER ||
				block.getType() == Material.STONE_BUTTON ||
				block.getType() == Material.STONE_PLATE ||
				block.getType() == Material.WOOD_PLATE ||<commit_msg>language check (+ added jukebox)<commit_after>package info.tregmine.chestbless;


//import org.bukkit.ChatColor;
//import org.bukkit.Location;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
//import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerListener;

public class BlessPlayer extends PlayerListener {
	private final Bless plugin;

	public BlessPlayer(Bless instance) {
		this.plugin = instance;
		plugin.getServer();
	}

	public void onPlayerInteract(PlayerInteractEvent event) {
		Player player = event.getPlayer();
		Block block = event.getClickedBlock();
		info.tregmine.api.TregminePlayer tregminePlayer = this.plugin.tregmine.tregminePlayer.get(player.getName());

		if ((event.getAction() == Action.RIGHT_CLICK_BLOCK  || event.getAction() == Action.LEFT_CLICK_BLOCK) && 
				(		block.getType() == Material.CHEST || 
						block.getType() == Material.FURNACE ||
						block.getType() == Material.BURNING_FURNACE ||
						block.getType() == Material.WOOD_DOOR ||
						block.getType() == Material.WOODEN_DOOR ||
						block.getType() == Material.LEVER ||
						block.getType() == Material.STONE_BUTTON ||
						block.getType() == Material.STONE_PLATE ||
						block.getType() == Material.WOOD_PLATE ||
						block.getType() == Material.WORKBENCH ||
						block.getType() == Material.SIGN_POST ||
						block.getType() == Material.DIODE ||
						block.getType() == Material.DIODE_BLOCK_OFF ||
						block.getType() == Material.DIODE_BLOCK_ON ||
						block.getType() == Material.JUKEBOX ||
						block.getType() == Material.SIGN)	
				) {
			Location loc = block.getLocation();
 			int checksum = (loc.getBlockX() + "," + loc.getBlockZ() +"," + loc.getWorld().getName()).hashCode();
			int newchecksum = (loc.getBlockX() + "," + loc.getBlockZ() + "," + loc.getBlockY() + "," + loc.getWorld().getName()).hashCode();
			
			if (this.plugin.chests.containsKey(checksum)) {
				
				String name = this.plugin.chests.get(checksum);
				player.sendMessage(ChatColor.AQUA + "You reblessed a block for " + name + ".");
				this.plugin.chests.put(newchecksum, name);
				this.plugin.chests.remove(checksum);
				info.tregmine.database.Mysql mysql = new info.tregmine.database.Mysql();
				mysql.connect();

				info.tregmine.chestbless.Store.savebless(newchecksum, name, player.getWorld().getName(), mysql);
				info.tregmine.chestbless.Store.deletebless(checksum, name, player.getWorld().getName(), mysql);
				mysql.close();

			}

		}

		
		if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.BONE && (tregminePlayer.isAdmin() || tregminePlayer.getMetaBoolean("bless") &&
				(		block.getType() == Material.CHEST || 
				block.getType() == Material.FURNACE ||
				block.getType() == Material.BURNING_FURNACE ||
				block.getType() == Material.WOOD_DOOR ||
				block.getType() == Material.WOODEN_DOOR ||
				block.getType() == Material.LEVER ||
				block.getType() == Material.STONE_BUTTON ||
				block.getType() == Material.STONE_PLATE ||
				block.getType() == Material.WOOD_PLATE ||
				block.getType() == Material.WORKBENCH ||
				block.getType() == Material.DIODE ||
				block.getType() == Material.DIODE_BLOCK_OFF ||
				block.getType() == Material.DIODE_BLOCK_ON ||
				block.getType() == Material.SIGN_POST ||
				block.getType() == Material.JUKEBOX ||
				block.getType() == Material.SIGN)	
				)) {
			Location loc = block.getLocation();
			int checksum = (loc.getBlockX() + "," + loc.getBlockZ() + "," + loc.getBlockY() + "," + loc.getWorld().getName()).hashCode();
			
			String name = tregminePlayer.getMetaString("chestbless");
			this.plugin.getServer().getPlayer(name).sendMessage(ChatColor.AQUA + "Your god blessed it in your name!");
			player.sendMessage(ChatColor.AQUA + "You blessed for " + name + ".");
			this.plugin.chests.put(checksum, name);
			info.tregmine.database.Mysql mysql = new info.tregmine.database.Mysql();
			mysql.connect();
			info.tregmine.chestbless.Store.savebless(checksum, name, player.getWorld().getName(), mysql);
			this.plugin.log.info(player.getName() + " Blessed a block " + checksum + " to " + name + ".");
			mysql.close();

			event.setCancelled(true);
			return;
		}


		if ((event.getAction() == Action.RIGHT_CLICK_BLOCK  || event.getAction() == Action.LEFT_CLICK_BLOCK) && 
				(		block.getType() == Material.CHEST || 
				block.getType() == Material.FURNACE ||
				block.getType() == Material.BURNING_FURNACE ||
				block.getType() == Material.WOOD_DOOR ||
				block.getType() == Material.WOODEN_DOOR ||
				block.getType() == Material.LEVER ||
				block.getType() == Material.STONE_BUTTON ||
				block.getType() == Material.STONE_PLATE ||
				block.getType() == Material.WOOD_PLATE ||
{'fraction_non_alphanumeric': 0.1657125332242895, 'fraction_numerical': 0.0, 'mean_word_length': 3.8915, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6740059', 'n_tokens_mistral': 3701, 'n_tokens_neox': 3279, 'n_words': 482}