Added Event allocation pool, updated SPL with Class::onClassLoaded()

This commit is contained in:
Shoghi Cervantes
2014-10-28 10:47:40 +01:00
parent 144a871c07
commit 350cee3d41
111 changed files with 327 additions and 109 deletions

View File

@ -135,7 +135,7 @@ class Explosion{
$yield = (1 / $this->size) * 100;
if($this->what instanceof Entity){
$this->level->getServer()->getPluginManager()->callEvent($ev = new EntityExplodeEvent($this->what, $this->source, $this->affectedBlocks, $yield));
$this->level->getServer()->getPluginManager()->callEvent($ev = EntityExplodeEvent::createEvent($this->what, $this->source, $this->affectedBlocks, $yield));
if($ev->isCancelled()){
return false;
}else{
@ -166,11 +166,11 @@ class Explosion{
$damage = (int) ((($impact * $impact + $impact) / 2) * 8 * $explosionSize + 1);
if($this->what instanceof Entity){
$ev = new EntityDamageByEntityEvent($this->what, $entity, EntityDamageEvent::CAUSE_ENTITY_EXPLOSION, $damage);
$ev = EntityDamageByEntityEvent::createEvent($this->what, $entity, EntityDamageEvent::CAUSE_ENTITY_EXPLOSION, $damage);
}elseif($this->what instanceof Block){
$ev = new EntityDamageByBlockEvent($this->what, $entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);
$ev = EntityDamageByBlockEvent::createEvent($this->what, $entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);
}else{
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);
$ev = EntityDamageEvent::createEvent($entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);
}
$this->level->getServer()->getPluginManager()->callEvent($ev);