Solved Jump Boost Plugin Help?

Discussion in 'Plugin Development' started by edwardb121, Jul 25, 2013.

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

    edwardb121

    Hi, I have been asked to make a plugin that I have not done or even thought of before. They would like me to make a plugin like on the hivemc.eu server when you step on the pressure plate its launches you the direction you are going. This is how far I have got to so far, Can someone help me please?
    Code:java
    1.  
    2. @EventHandler
    3. public void onPlayerMove(PlayerMoveEvent event) {
    4. Player player = event.getPlayer();
    5. if(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() ==Material.DIAMOND_BLOCK) {
    6. player.getLocation().getDirection()
    7. }
    8. }
    9. }
    10.  
     
  2. Offline

    Asgernohns

    edwardb121

    if you wanna give a potion effect to yourself just copy this:
    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, <duralation in ticks>, <strength>));

    Remember that 1 tick = 0.05 sec.
    20 ticks = 1 sec. :)
     
  3. Offline

    edwardb121

    No. I know how to give someone a potion that easy, I'm talking about vectors
     
  4. Offline

    Tomskied

    PlayerMoveEvent is very intensive, I'm pretty sure even a thread that checks every tick is still less frequent then the PlayerMoveEvent.

    That aside, what part of the vectors do you need help with? You could always get the velocity that the player is at at the moment to get the current velocity. Then modify the components of the velocity to suit what kind of impulse you are wanting.
     
  5. Offline

    xTrollxDudex

    edwardb121
    Listen for player interact event and check if the action is physical. Then set his velocity to his direction, and add a bit to the Y component
     
    PogoStick29 likes this.
  6. Offline

    edwardb121

    Could you write it in some code please :).
     
  7. Offline

    xTrollxDudex

    edwardb121
    I'll just do the vector part
    PHP:
    Vector vector = new Vector();

    double rotX p.getYaw();
    double rotY p.getPitch();

    vector.setY(-Math.sin(Math.toRadians(1.5)));
      
    double h Math.cos(Math.toRadians(rotY));

    vector.setX(-Math.sin(Math.toRadians(rotX)));
    vector.setZ(Math.cos(Math.toRadians(rotX)));

    p.setVelocity(vector.multiply(2));
    You may have to adjust the 1.5 and the 2 to you liking, 1.5 being the height(I believe) and 2 being the speed.
     
Thread Status:
Not open for further replies.

Share This Page