1.15.2 Y axis of vector only working on jump

Discussion in 'Spigot Plugin Development' started by xUltraGaming, Mar 22, 2020.

Thread Status:
Not open for further replies.
  1. I've been trying to make a feature for a plugin where when a player is hit, they are sent backwards into the air.
    See the spoiler below for the code.

    Code (Java):

    // a is a player
    Vector v = a.getLocation().getDirection().multiply(-3);

    When the player is hit, they get launched backwards a few blocks. Although the Y axis is set to 2, the player is not being launched in the air. However, when the player is jumping, they get launched far into the air. My goal is to have the player be launched into the air and backwards at the same time regardless if they are jumping or not.

    If anyone could help me figure this out, that would be greatly appreciated. Thanks!
  2. Well when moving there is no vertical velocity,only horizontal one,you have to create one yourself

    You'r getting the vector from direction but in that current case you are multiplying 0 by -3 (wich is pointless if the user isn't jumping or anything related)
  3. S
    So I would have to create a vector and then apply it to the player?
    Using the Vector(x, y, z) method, how would I be able to make the player move backwards in a straight line?
Thread Status:
Not open for further replies.