mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Merge branch 'release/3.2'
This commit is contained in:
commit
202fb08792
@ -560,7 +560,7 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attackTime = 10; //0.5 seconds cooldown
|
$this->attackTime = $source->getAttackCooldown();
|
||||||
|
|
||||||
if($source instanceof EntityDamageByEntityEvent){
|
if($source instanceof EntityDamageByEntityEvent){
|
||||||
$e = $source->getDamager();
|
$e = $source->getDamager();
|
||||||
|
@ -69,6 +69,9 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
|||||||
/** @var float[] */
|
/** @var float[] */
|
||||||
private $originals;
|
private $originals;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $attackCooldown = 10;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Entity $entity
|
* @param Entity $entity
|
||||||
@ -197,4 +200,24 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the cooldown in ticks before the target entity can be attacked again.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getAttackCooldown() : int{
|
||||||
|
return $this->attackCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the cooldown in ticks before the target entity can be attacked again.
|
||||||
|
*
|
||||||
|
* NOTE: This value is not used in non-Living entities
|
||||||
|
*
|
||||||
|
* @param int $attackCooldown
|
||||||
|
*/
|
||||||
|
public function setAttackCooldown(int $attackCooldown) : void{
|
||||||
|
$this->attackCooldown = $attackCooldown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user