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

Solved How to get shooter entity in ProjectileHitEvent?

Discussion in 'Development' started by Yexeed, Nov 2, 2017.

  1. Yexeed

    Yexeed Slime

    Messages:
    76
    The question in the title. I want to teleport player in place that arrow hits.
     
  2. Yexeed

    Yexeed Slime

    Messages:
    76
    Solved:
    PHP:
    public function onProjectileHit(ProjectileHitEvent $e){
            if(
    $e->getEntity() instanceof Arrow){
                
    $shootentity $e->getEntity()->getOwningEntity();
                if(
    $shootentity instanceof Player){
                    
    $shootentity->sendMessage("you are shooted from bow lol");
                }
            }
        }
     
  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.