Damage not listening

Discussion in 'Plugin Development' started by lpjz2, Mar 25, 2011.

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

    lpjz2

    my EntityDamageEvent isnt picking anything up or acting upon anything, for example...
    Code:
    public void onEntityDamage(EntityDamageEvent event,CommandSender sender){
        Player player = ((Player)sender);
        player.sendMessage("Test Damage");
        
        }
    
    doesnt even say "Test Damage" when i take damage...

    this is my plugin manager thingy....
    Code:
    private final TestDListen damageListener = new TestDListen(this);
    
    Code:
    PluginManager pm = getServer().getPluginManager();
        pm.registerEvent(Event.Type.ENTITY_DAMAGE,damageListener, Event.Priority.Normal, this);
    
    I think im not understanding something about the registering events? is this correct?

    oh yeah, and just incase this is incorrect this i the start of my DamageListener Class...

    Code:
    public class TestDListen extends EntityListener{
        public static Test plugin;
        public TestDListen(Test instance) {
            plugin = instance;
    }
    
    
    thanks in advance =)
     
  2. Offline

    Carnes

    I think it's onEntityDamage. Try this instead:
    Code:
        public void onEntityDamage(EntityDamageEvent event)
        {
            Entity entity = event.getEntity();
            if(entity instanceof Player)
            {
               ...
    
     
Thread Status:
Not open for further replies.

Share This Page