Prevent Damage?

Discussion in 'Plugin Development' started by Meta1203, Jan 18, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Meta1203

    Hey,
    I was wondering how to prevent a player from being damaged on onDamageEntity() event? Here is a snippet my code so far:
    Code:
    public void onEntityDamage (EntityDamageEvent event) {
            Entity damagee = event.getEntity();
            if (damagee instanceof Player) {
                System.out.println("Player Damaged!");
                Player player = (Player)damagee;
                if (ETCPlayerListener.gods.contains(player.getName())) {
                    System.out.println("God Player Damaged!");
                    event.setCancelled(true);
                }
            }
    
        }
    I jump off a cliff and nothing happens in the output, and I get hurt as usual.
    What is wrong here?
     
  2. Offline

    Lycake

    Same problem here. Seems that falling damage is not triggered yet?!
     
  3. Offline

    Plague

    It is not yet implemented, they are wokring on it.

    In the Meantime use SimpleGod by Silence. It does it differently, but serves the purpose for now.
     
  4. Offline

    Mattie

    Drowning damage event also wasn't triggering last I checked.
     
  5. Offline

    Silence

    The entity damaged by block event seemed to work a few versions back, but behaves differently on current builds.
    When I have the time I'll bisect bukkit :/
     
  6. Offline

    8e8

    Cogito (the dev currently working on this) said he's been doing a lot in regards to this. Drowning, and falling will not register in the damage events. Damage by block falling was working for me, but I didn't test it in the more recent build (tested on #81).

    I finished my plugin not long ago which used to use sethealth on damage, but I took it out since setCancelled was going to replace it anyway. It has flatfile support for permissions as well as support for GroupUsers (temporarily). I'm just waiting on those events to register properly. /advertise

    Hopefully within the next few builds it will be fixed and our plugins can work as they should.
     
  7. Offline

    Taco

    I cannot get fall damage, drowning damage, or suffocation damage to trigger on the latest build. We shall have to wait for an update I suppose.
     
  8. Offline

    Plague

    Since I started experimented (CB ver. 5x) it never worked properly for those events. There is a bug filed and a dev also reponded to it, so there is nothing for us to do other than wait it out.
     
Thread Status:
Not open for further replies.

Share This Page