Launching Players

Discussion in 'Plugin Development' started by stantheman68, Jul 30, 2012.

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

    stantheman68

    I was wondering if there is anyway to launch a player in the air. If you know how can you please paste the code in the comments?
     
  2. Offline

    SirTyler

    I will give you the idea, player.setVelocity(up);

    You figure out how to make it work.
     
    CorrieKay likes this.
  3. Offline

    sd5

    Code:
    player.setVelocity(player.getVelocity().setY(5000));
    Don't wonder if you don't see your world anymore xD
     
  4. Offline

    stantheman68

    I tried yours but when I put the code in and when I did the command it didnt do anything

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  5. Offline

    Scizzr

    Think of velocity as the player actually moving, as in vectors. You need to set their pitch to -90 (make the vector aim up) for them to move up. Multiplying that causes the effect to increase.

    Code:
    Location location = player.getLocation().clone();
    location.setPitch(-90);
    Vector direction = location.getDirection();
    player.setVelocity(direction.multiply(2.0));
    
    That will cause the player to sort of 'jump up'.
     
  6. Offline

    r0306

    stantheman68
    Did you register the command in the plugin.yml and if you were handling the command in a class other than you main, did you set the command handler for that command?
     
  7. Offline

    stantheman68

    LOL its seems I was spelling the command wrong in the plugin.yml Thanks a whole bunch Everyone!
     
  8. Offline

    sd5

    No you don't need that... x goes always to x, z goes always to z and y goes always to y and that means: up
     
  9. Offline

    Scizzr

    Hmm, ok. I see what his problem was. I've always done it the "pitch way" without problem myself, so that's what I thought the problem was.
     
Thread Status:
Not open for further replies.

Share This Page