[Solved] How to cancel out all damage except for SUICIDE

Discussion in 'Spigot Plugin Development' started by martin0leung, May 17, 2015.

  1. So I want to just cancel out ALL the damage except for doing /kill
    Here is my code:
    Code (Text):
        @EventHandler
        public void Damage(EntityDamageEvent e) {
            if (e.getEntity() instanceof Player) {
                if (e.getCause() != DamageCause.SUICIDE) {
                    e.setCancelled(true);
                }
            }
        }
    But it it does not do that, it still cancels out /kill, how do I fix this?
     
  2. Try DamageCause.VOID instead of DamageCause.SUICIDE, it's the one the minecraft kill command uses
     
    • Informative Informative x 1
  3. Thanks!