Living: fixed cooldown damage logic, closes #2939

This commit is contained in:
Dylan K. Taylor
2020-05-31 19:46:51 +01:00
parent 0d4e473bdd
commit 5dadf12374
2 changed files with 8 additions and 5 deletions

View File

@ -40,6 +40,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
public const MODIFIER_CRITICAL = 7;
public const MODIFIER_TOTEM = 8;
public const MODIFIER_WEAPON_ENCHANTMENTS = 9;
public const MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10;
public const CAUSE_CONTACT = 0;
public const CAUSE_ENTITY_ATTACK = 1;
@ -181,4 +182,8 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
public function setAttackCooldown(int $attackCooldown) : void{
$this->attackCooldown = $attackCooldown;
}
public function isCancelled() : bool{
return parent::isCancelled() or $this->getFinalDamage() <= 0;
}
}