1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Cant get shooting entity on projectile hit event.

Discussion in 'Development' started by Kabluinc, Jun 11, 2017.

  1. Kabluinc

    Kabluinc Baby Zombie

    Messages:
    129
    I'm trying to get the shooting entity on the projectilehitevent. But I'm getting the following error:

    Code:
    2017-06-11 [22:24:38] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\entity\ProjectileHitEvent' to 'T': Undefined property: pocketmine\entity\Arrow::$shootingEntity on \TW\Events
    2017-06-11 [22:24:38] [Server thread/CRITICAL]: ErrorException: "Undefined property: pocketmine\entity\Arrow::$shootingEntity" (EXCEPTION) in "/T/src/TW/Events" at line 76
    This is line 75 and 76:

    PHP:
    public function removeArrow(ProjectileHitEvent $event){
    $p $event->getEntity()->shootingEntity;
    Please help.
     
  2. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    Try using $event->getEntity()->getOwningEntity().
    It seems like that should be what you need according to this.
     
    Last edited: Aug 19, 2018
  3. Kabluinc

    Kabluinc Baby Zombie

    Messages:
    129
    Thanks :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.