SPIGOT-6779: Fix LivingEntity#attack for Player entities

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot 2021-11-02 18:33:35 +11:00
parent 9e3a0e859f
commit fda316b6eb

View file

@ -651,7 +651,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
Preconditions.checkArgument(target != null, "target == null");
Preconditions.checkState(!getHandle().generation, "Cannot attack during world generation");
getHandle().attackEntity(((CraftEntity) target).getHandle());
if (getHandle() instanceof EntityHuman) {
((EntityHuman) getHandle()).attack(((CraftEntity) target).getHandle());
} else {
getHandle().attackEntity(((CraftEntity) target).getHandle());
}
}
@Override