Solved Arrow Shoot

Discussion in 'Plugin Development' started by TheDiamond06, Jun 2, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    TheDiamond06

    I am using ProjectileLaunchEvent to try and set the durability of a bow to max whenever it is shot. However there seems to be no method to get the player or the source it was shot from. How would I get the player or itemstack a projectile was launched from?
     
  2. Offline

    VortexGmer

    I'm on my mobile, Is it e.getProjectile().getShooter()?
    Something like that. It may be directly e.getShooter()?
     
  3. Yes, it is event.getEntity().getShooter().

    Make sure to check if it is a Player shooting, as I think things like a Skeleton shooting would also trigger this event.
     
  4. Offline

    WishMachine

    if (event.getEntity().getShooter() instanceof player) {
    event.setCancelled(true);
    }

    it would look something like this if you want to check for player
     
  5. Offline

    TheDiamond06

Thread Status:
Not open for further replies.

Share This Page