Solved DamageByEntityEvent running when hit slowly

Discussion in 'Spigot Plugin Development' started by pas5w0rd, May 2, 2017.

Thread Status:
Not open for further replies.
  1. Hello all.

    I am working on a damage event. However, when the player is being hit quickly, it wont run but when they are running and aren't hit every second, it does run.

    Code (Text):
    @EventHandler(priority = EventPriority.LOWEST)
        public void killedByEntity(EntityDamageByEntityEvent e)
        {
            if(e.getDamager() instanceof Player && e.getEntity() instanceof Player)
            {
                Player damager = (Player) e.getDamager();
                Player damaged = (Player) e.getEntity();
               
           
                        if(damaged.getHealth() < 2)
                        {
                   
                VisualUtils.sendLightning(damaged.getLocation());
                       
                   
                }
            }
        }
    I use this because I have instant respawn in a different plugin so I check in this- but like above, most of the time, it won't run.
    How can I fix this?

    Thanks.
    :D
     
  2. Use playerdeathEvent and get deathlocation by getting location of the player and send the lightning effect.
     
  3. Instant Respawn, wouldn't work, or would it?
     
  4. It should work.
    Edit:nvm removed that since i just realized that it wasnt cancellable
     
  5. o yeah lol
     
Thread Status:
Not open for further replies.