Fix no knock back on player NPC's when hit

Attempt number 2 due to git noob mistakes.
This commit is contained in:
JCThePants 2015-02-24 10:01:32 -08:00
parent c747d59482
commit c924547e52

View File

@ -87,6 +87,23 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
}
}
@Override
public boolean damageEntity(DamageSource damagesource, float f) {
// knock back velocity is cancelled and sent to client for handling when
// the entity is a player. there is no client so make this happen manually.
boolean damaged = super.damageEntity(damagesource, f);
if (damaged && velocityChanged) {
velocityChanged = false;
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
@Override
public void run() {
EntityHumanNPC.this.velocityChanged = true;
}
});
}
return damaged;
}
@Override
public void die(DamageSource damagesource) {
// players that die are not normally removed from the world. when the