Code: public int cooldown4 = 3; public String ThorCooldownMessage = ChatColor.RED + "Aguarde a cooldown!"; public int ThorItemId = Material.IRON_AXE.getId(); HashMap<String, Long> Thor = new HashMap<String, Long>(); @EventHandler public void PlayerInteract(PlayerInteractEvent event){ if(event.getAction() == Action.RIGHT_CLICK_BLOCK){ final Player player = event.getPlayer(); ItemStack item = event.getPlayer().getItemInHand(); if (item.getTypeId() == ThorItemId){ long lastUsed = 0; if (Thor.containsKey(player.getName())) lastUsed = Thor.get(player.getName()); if (lastUsed + (1000 * cooldown4) > System.currentTimeMillis()) { event.getPlayer().sendMessage( String.format(ThorCooldownMessage, (-((System.currentTimeMillis() - (lastUsed + (1000 * cooldown4))) / 1000)))); } else { Block block = player.getTargetBlock(null, 50); Location location = block.getLocation(); World world = player.getWorld(); world.strikeLightning(location); Thor.put(player.getName(), System.currentTimeMillis()); } } } How I can make the player which is using the IRON_AXE immune to the lightingStrike?
Maybe you could listen to EntityDamageEvent, and cancel it if the item in hand is an iron axe && the damage was caused by lightning. Or make the lightning strike happen on a 1-tick delay, and cancel the damage if the player is in your Thor set.