mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 18:47:40 +01:00
Fix no knock back on player NPC's when hit
Attempt number 2 due to git noob mistakes.
This commit is contained in:
parent
c747d59482
commit
c924547e52
@ -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