OnEntityDamage, and obtaining a player.

Discussion in 'Plugin Development' started by Reil, Jan 16, 2011.

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

    Reil

    Sooo, in an attempt to fake an onPlayerDeath kind of hook, I've done the following:
    Code:
    	public void onEntityDamage(EntityDamageEvent event) {
    		if (!(event.getEntity() instanceof Player)) return;
    		Player damaged = (Player) event.getEntity();
    		if (!event.isCancelled() &&  event.getDamage() >= damaged.getHealth()){
    			rTriggers.log.info("Player dead.");
    			onEntityDeath(event);
    		}
    	}
    Only nothing seems to be getting past the first line in the function. That is, I'm not getting instances of players. I am having instances of LivingEntities show up. The trigger doesn't seem to be happening when a player is hit, or something. Am I doing things wrong? I don't want to file a bug report if I'm just misunderstanding something. =S
     
  2. Offline

    LRFLEW

  3. Offline

    8e8

    Check for human entity?
     
Thread Status:
Not open for further replies.

Share This Page