mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 05:05:20 +01:00
Merge pull request #255 from JCThePants/JCThePants-patch-4
Fix no knock back on player NPC's when hit
This commit is contained in:
commit
f290618277
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user