Use null coalesce in EntityDamageEvent

This commit is contained in:
Dylan K. Taylor 2017-09-03 12:48:57 +01:00
parent cb7911ee9c
commit 58bf5d6679

View File

@ -100,11 +100,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
* @return float
*/
public function getOriginalDamage(int $type = self::MODIFIER_BASE) : float{
if(isset($this->originals[$type])){
return $this->originals[$type];
}
return 0.0;
return $this->originals[$type] ?? 0.0;
}
/**
@ -113,11 +109,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
* @return float
*/
public function getDamage(int $type = self::MODIFIER_BASE) : float{
if(isset($this->modifiers[$type])){
return $this->modifiers[$type];
}
return 0.0;
return $this->modifiers[$type] ?? 0.0;
}
/**