<commit_before>package biz.orgin.minecraft.hothgenerator;

import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;

/**
 * BlockBreakEvent listener. Makes sure that ice and snow blocks breaks into blocks that the player can pick up. 
 * @author orgin
 *
 */
public class BlockBreakManager implements Listener
{
	private HothGeneratorPlugin plugin;

	public BlockBreakManager(HothGeneratorPlugin plugin)
	{
		this.plugin = plugin;
	}

	@EventHandler(priority = EventPriority.HIGHEST)
	public void onBlockBreak(BlockBreakEvent event)
	{
		if(!event.isCancelled())
		{
			Block block = event.getBlock();
			World world = block.getWorld();
			Player player = event.getPlayer(); 
	
			GameMode gamemode = player.getGameMode();
	
			if (!gamemode.equals(GameMode.CREATIVE))
			{
				if (this.plugin.isHothWorld(world) && block.getType().equals(Material.ICE))
				{
					block.setType(Material.AIR);
					if(this.plugin.isRulesDropice(block.getLocation()))
					{
						ItemStack iceStack = new ItemStack(Material.ICE);
						iceStack.setAmount(1);
						block.getWorld().dropItem(block.getLocation(), iceStack);
					}
				}
				else if (this.plugin.isHothWorld(world) && block.getType().equals(Material.SNOW_BLOCK))
				{
					block.setType(Material.AIR);

					if(this.plugin.isRulesDropsnow(block.getLocation()))
					{
						ItemStack iceStack = new ItemStack(Material.SNOW_BLOCK);
						iceStack.setAmount(1);
						block.getWorld().dropItem(block.getLocation(), iceStack);
					}
				}
			}
		}
	}

}<commit_msg>Fixed potential anyone-can-break-blocks problem<commit_after>package biz.orgin.minecraft.hothgenerator;

import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;

/**
 * BlockBreakEvent listener. Makes sure that ice and snow blocks breaks into blocks that the player can pick up. 
 * @author orgin
 *
 */
public class BlockBreakManager implements Listener
{
	private HothGeneratorPlugin plugin;

	public BlockBreakManager(HothGeneratorPlugin plugin)
	{
		this.plugin = plugin;
	}

	@EventHandler(priority = EventPriority.HIGHEST)
	public void onBlockBreak(BlockBreakEvent event)
	{
		if(!event.isCancelled())
		{
			Block block = event.getBlock();
			World world = block.getWorld();
			Player player = event.getPlayer(); 
	
			GameMode gamemode = player.getGameMode();
			
			
			if (!gamemode.equals(GameMode.CREATIVE))
			{
				if (this.plugin.isHothWorld(world) && block.getType().equals(Material.ICE))
				{
					if(this.plugin.isRulesDropice(block.getLocation()))
					{
						block.setType(Material.AIR);
						ItemStack iceStack = new ItemStack(Material.ICE);
						iceStack.setAmount(1);
						block.getWorld().dropItemNaturally(block.getLocation(), iceStack);
						
					}
				}
				else if (this.plugin.isHothWorld(world) && block.getType().equals(Material.SNOW_BLOCK))
				{
					if(this.plugin.isRulesDropsnow(block.getLocation()))
					{
						block.setType(Material.AIR);
						ItemStack snowStack = new ItemStack(Material.SNOW_BLOCK);
						snowStack.setAmount(1);
						block.getWorld().dropItemNaturally(block.getLocation(), snowStack);

					}
				}
			}
		}
	}

}
{'fraction_non_alphanumeric': 0.11974904528096017, 'fraction_numerical': 0.0010911074740861974, 'mean_word_length': 3.942048517520216, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2367851', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1169, 'n_words': 205}