Solved EntityDamageByBlockEvent instanceof p.getLastDamageCause() - Invalid

Discussion in 'Plugin Development' started by libraryaddict, Nov 25, 2012.

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

    libraryaddict

    Code:
    @EventHandler
      public void onPlayerDeath(PlayerDeathEvent event) {
        Player p = event.getEntity();
          EntityDamageEvent entityDamage = p.getLastDamageCause();
          if (entityDamage instanceof EntityDamageByBlockEvent)
            System.out.print("Last damaged by block explode");
    }
    The problem is. I can check if its a instance of EntityDamageByEntityEvent.
    But not if its a EntityDamageByBlockEvent.

    Both of them extend the same class and there's practically no difference from what I can tell.

    Anyone have the answer as to why I can't compare them?

    Eclispe gives the error 'Incompatible conditional operand types EntityDamageEvent and EntityDamageByBlockEvent'
     
  2. Offline

    fireblast709

    libraryaddict likes this.
  3. Offline

    libraryaddict

Thread Status:
Not open for further replies.

Share This Page