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?
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.
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 :/
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.
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.
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.