/** * @param Event $event */ public function callEvent(Event $event) { if ($event instanceof Cancellable and $event->isCancelled() and $this->isIgnoringCancelled()) { return; } $this->timings->startTiming(); $this->executor->execute($this->listener, $event); $this->timings->stopTiming(); }
public function removeArrow(Event $event) { if ($event->isCancelled()) { return; } $arrow = $event->getEntity(); $murder = $event->getEntity()->shootingEntity; $this->getServer()->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($arrow, 3.2)); if (!$ev->isCancelled()) { $explosion = new Explosion($arrow, $ev->getForce(), $murder); $explosion->explodeB(); } $reflection_class = new \ReflectionClass($arrow); $property = $reflection_class->getProperty('age'); $property->setAccessible(true); $property->setValue($arrow, 7000); }