Merge pull request #255 from JCThePants/JCThePants-patch-4

Fix no knock back on player NPC's when hit
This commit is contained in:
fullwall 2015-03-05 17:48:43 +08:00
commit f290618277

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