Solved Firing Arrow

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

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

    TheDiamond06

    I am trying to shoot an arrow from a player, however it seems like it does not want to work like a fireball. Using:
    Code:java
    1. Player#launchProjectile(Arrow.class);

    does not work. I then checked the forums for another way: https://bukkit.org/threads/change-the-item-for-shooting-an-arrow.119798/ and it shows that this is the way to do it. Console points an error at the line launching this projectile... Saying that this is asynchronus or some word like that. What exactly is the problem?
     
  2. Offline

    caderape

    @TheDiamond06
    Check if you don't have something that pertub the projectile cuz, that should work.
     
  3. Offline

    TheDiamond06

    @caderape
    Code:java
    1. if(arrow.containsKey(p))
    2. {
    3. int time = arrow.get(p);
    4. if(time <= 0)
    5. {
    6. arrow.remove(p);
    7. return;
    8. }
    9. for(int i=0;i<11;i++)
    10. {
    11. p.launchProjectile(Arrow.class);
    12. }
    13. time = time - 1;
    14. arrow.put(p, time);
    15. }

    Might help?
    Also this is inside a scheduler running every 6 ticks. There is more code to it, but too much to show here. I have looped through all the players on the server

    @TheDiamond06 Nevermind, the problem was that I was doing an Async Task

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page