mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Added Event allocation pool, updated SPL with Class::onClassLoaded()
This commit is contained in:
@ -124,7 +124,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
return;
|
||||
}
|
||||
parent::kill();
|
||||
$this->server->getPluginManager()->callEvent($ev = new EntityDeathEvent($this, $this->getDrops()));
|
||||
$this->server->getPluginManager()->callEvent($ev = EntityDeathEvent::createEvent($this, $this->getDrops()));
|
||||
foreach($ev->getDrops() as $item){
|
||||
$this->getLevel()->dropItem($this, $item);
|
||||
}
|
||||
@ -135,7 +135,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
parent::entityBaseTick();
|
||||
|
||||
if($this->dead !== true and $this->isInsideOfSolid()){
|
||||
$this->server->getPluginManager()->callEvent($ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1));
|
||||
$this->server->getPluginManager()->callEvent($ev = EntityDamageEvent::createEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1));
|
||||
if(!$ev->isCancelled()){
|
||||
$this->attack($ev->getFinalDamage(), $ev);
|
||||
}
|
||||
@ -146,7 +146,7 @@ abstract class Living extends Entity implements Damageable{
|
||||
if($this->airTicks <= -20){
|
||||
$this->airTicks = 0;
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2));
|
||||
$this->server->getPluginManager()->callEvent($ev = EntityDamageEvent::createEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2));
|
||||
if(!$ev->isCancelled()){
|
||||
$this->attack($ev->getFinalDamage(), $ev);
|
||||
}
|
||||
|
Reference in New Issue
Block a user