Solved Jump pad not launching upwards

Discussion in 'Plugin Development' started by PureGero, Apr 13, 2014.

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

    PureGero

    I am making a Jump Pad plugin with this code:
    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent e){
    3. if(e.getAction() == Action.PHYSICAL && e.getClickedBlock().getType() == Material.STONE_PLATE){
    4. e.getPlayer().setVelocity(
    5. e.getPlayer().getEyeLocation().getDirection()
    6. .normalize().multiply(4).setY(1));
    7. }
    8. }

    The problem with this code is that when it launches me, it only changes my X and Z coords, not affecting my Y coord. There are no errors in the console, help?
    Thank in advance :)
     
  2. Offline

    Phyla

    if you only want to launch them upwards, set the velocity, make the x and z 0 and make the y however high you want them to go.
     
  3. Offline

    rohan576

    While I'm really not sure if this will work, do try setY(1.0), instead of an integer.
     
  4. Offline

    PureGero

    Phyla I'm using Player.setVelocity(new Vector(0,1,0)) and still it is not launching upwards...

    rohan576 This doesn't seem to change anything...
     
  5. Offline

    Bionicrm

    Try teleporting them 1 block up from their current position before setting their velocity.
     
    iKeirNez likes this.
  6. Offline

    PureGero

    Bionicrm Somehow it works! Thank you!
     
Thread Status:
Not open for further replies.

Share This Page