1.14.4 Cancelling damages made by setHealth()

Discussion in 'Spigot Plugin Development' started by DytroPlays, Jan 30, 2020.

  1. I was recently making a plugin for an RPG server. So, I displayed the health using setHealth(). But, I want to make the damage event only cancel damage that is changed using setHealth(). I tried
    Code (Java):
    !e.getCause().equals(DamageCause.CUSTOM)
    , but didn't work. Can somebody help?
     
  2. have you tested if setHealth() actually fires a damage event?
     
  3. no,let me just make sure.
     
  4. You could potentially make a custom spigot jar and modify the setHealth() bit to call a custom event.