Solved cancelling EntityDamageEvent and Fire

Discussion in 'Spigot Plugin Help' started by Demonkid1112, Jun 25, 2018.

  1. Soo I am creating a custom health plugin, I did the basics of it all and the on damage part of my code looks like

    Code (Text):
        public void onDamage(EntityDamageEvent event) {
            if (event.getEntity() instanceof Player) {
                Player p = (Player) event.getEntity();
                setCurHealth(p, (int) (getCurHealth(p) - event.getDamage()));
    but when I do this I realized when I stand in fire I loose 1 health every tick, any fix?
  2. Since you cancel the event and manage the damage manually the players no damage cooldown doesn't get activated. Therefore the fire doesn't have to wait until the ticks warn off and can damage you every tick.
    You can use Player#setNoDamageTicks() to prevent that
    • Winner Winner x 1