OnEntityDamage, and obtaining a player.

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

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


    Sooo, in an attempt to fake an onPlayerDeath kind of hook, I've done the following:
    	public void onEntityDamage(EntityDamageEvent event) {
    		if (!(event.getEntity() instanceof Player)) return;
    		Player damaged = (Player) event.getEntity();
    		if (!event.isCancelled() &&  event.getDamage() >= damaged.getHealth()){"Player dead.");
    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


  3. Offline


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

Share This Page