Solved Arrow from location to player

Discussion in 'Spigot Plugin Development' started by Error202, Jun 29, 2016.

  1. Hi!

    I need spawn arrow from locaton to player...
    Found solution
    Code (Text):
     Location loc1 = player.getEyeLocation();
    Location loc2 = new Location(world, x,y,z);
    loc2.getWorld().spawnArrow(loc2, new Vector(loc1.getX()-loc2.getX(), loc1.getY()-loc2.getY(), loc1.getZ()-loc2.getZ()), arrowSpeed, 12);
     
    But arrow stand in start block... :(
    What's wrong

    Sorry for my English
     
  2. You could create a BlockIterator and iterate through it until you reach an air block. Use this first air block as your starting/spawn location.
     
    • Agree Agree x 1
  3. Thanks! y+1 all ok