<commit_before>package ca.kanoa.RodsTwo.Rods;

import ca.kanoa.RodsTwo.Objects.ConfigOptions;
import ca.kanoa.RodsTwo.Objects.Rod;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.Plugin;

public class Lightning extends Rod {

    public Lightning(Plugin plugin) throws Exception {
        super("Lightning", 1, 280,  new ConfigOptions(new String[]{"max_distance"}, new Object[]{50}), 1500, plugin);

        //Set default the recipe
        super.setRecipe(new ShapedRecipe(super.getItem()).shape(" I ", " R ", " I ").setIngredient('I', Material.IRON_INGOT).setIngredient('R', Material.STICK));
    }

    @Override
    public boolean run(Player player, ConfigurationSection config){
        player.getWorld().strikeLightning(player.getTargetBlock(null, config.getInt("max_distence")).getLocation());
        return true;
    }
}<commit_msg>When player dies from Lightning rod, it credits the attacker<commit_after>package ca.kanoa.RodsTwo.Rods;

import java.util.HashMap;

import ca.kanoa.RodsTwo.RodsTwo;
import ca.kanoa.RodsTwo.Objects.ConfigOptions;
import ca.kanoa.RodsTwo.Objects.Rod;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.Plugin;

public class Lightning extends Rod implements Listener {

	private HashMap<Integer, String> strikeID;
	
    public Lightning(Plugin plugin) throws Exception {
        super("Lightning", 1, 280,  new ConfigOptions(new String[]{"max_distance"}, new Object[]{50}), 1500, plugin);

        //Set default the recipe
        super.setRecipe(new ShapedRecipe(super.getItem()).shape(" I ", " R ", " I ").setIngredient('I', Material.IRON_INGOT).setIngredient('R', Material.STICK));
    }

    @Override
    public boolean run(Player player, ConfigurationSection config){
    	final int id = player.getWorld().strikeLightning(player.getTargetBlock(null, config.getInt("max_distence")).getLocation()).getEntityId();
        strikeID.put(id, player.getName());
        Bukkit.getScheduler().scheduleSyncDelayedTask(RodsTwo.plugin, new Runnable(){
			public void run() {
				strikeID.remove(id);
			}}, 100);
        return true;
    }
    
    @Override
    public boolean enable(Server serv) {
    	strikeID = new HashMap<Integer, String>();
    	Bukkit.getPluginManager().registerEvents(this, RodsTwo.plugin);
    	return true;
    }
    
    @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
    public void onPlayerDeath(EntityDamageByEntityEvent event) {
    	if (event.getEntity() instanceof Player && 
    			event.getDamager() instanceof LightningStrike &&
    			strikeID.containsKey(event.getDamager().getEntityId()) &&
    			((Player)event.getEntity()).getHealth() - event.getDamage() <= 0 &&
    			Bukkit.getServer().getPlayer(strikeID.get(event.getDamager().getEntityId())) != null) {
    		event.setCancelled(true);
    		((Player)event.getEntity()).damage(event.getDamage(), Bukkit.getPlayer(strikeID.get(event.getDamager().getEntityId())));
    	}
    }
    
}
{'fraction_non_alphanumeric': 0.13019630484988454, 'fraction_numerical': 0.006928406466512702, 'mean_word_length': 4.465299684542587, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '5550955', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1079, 'n_words': 199}