[URGENT] Player Damage Error

Discussion in 'Plugin Development' started by FatAussieFatBoy, Dec 11, 2013.

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

    FatAussieFatBoy

    Hi so after 3 Days of trying to get my code to work with the EntityDamageEvent, I did it but I now have a Bigger problem... I need to know how to fix this Error of mine, I created a De-Bug Message on each line of code, and with that we narrowed down the Line of code that is having the Problem, the Problem as far as we know it is that the DamageCause isn't registering when a Player hurts a Player...

    CODE :
    if(cause == DamageCause.ENTITY_ATTACK) {
    if(p.getLastDamageCause().getEntity() instanceof Player) {
    Player pl = (Player) p.getLastCauseDamage().getEntity();
    //DO STUFF
    }
    }

    If anyone has any Ideas on how I could fix this then Please Tahg me with a Response ASAP as I needed this done 2 Days ago but am now turning to you (The Bukkit Community) for an answer...

    Cheers -
    FatAussieFatBoy
     
  2. Offline

    sgavster

    Just do this..
    Code:java
    1. public void onDamage(EntityDamageByEntityEvent e) {
    2. if(e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
    3. }
    4. }
     
Thread Status:
Not open for further replies.

Share This Page