Set player flight and walking speed

Discussion in 'Plugin Development' started by tschagg, Aug 10, 2012.

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



    Problem fixed.
  2. Offline


  3. Offline


    how i use that? like player.setFlySpeed(2); or something?
  4. Offline


    Really, you should start using Bukkit's Javadocs.
    void setWalkSpeed(float value)
    void setFlySpeed(float value)
    So yes, Player.setFlySpeed(2) will work.
  5. Offline


    Does this also work for swimming? (setWalkSpeed)
  6. Offline


    hm that isnt workin for me.
    i've made it like this:

          if (cmd.getName().equalsIgnoreCase("fs")) {
              if (sender.hasPermission("tschagg.setflyspeed")) {
            if (args.length == 0) {
              succeed = true;


    if you make player.setFlySpeed(1);

    it works :) thx for help!

    how can i set a variable in player.setFlySpeed(); ?

    player.setFlySpeed(args[0]); isnt workin, and if i do a string, like:
              String flyspeed = 1;
    that dont work too...
    anyone a idea?

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


    It doesn't accept a String as an argument. Look at the javaDocs.
    tschagg likes this.
  8. Offline


    It tells me I can only use an integer between 1 and -1. Does that mean every incremental value you want to use must be something very small with a decimal? I'm kind of confused about how it measures speed changes.
  9. Offline


    I am guessing 0 means no modifier, so it would be normal fly speed. So try 0.5 and see the difference...
  10. Offline


    Okay, I works like this:

    Let's say 1 = 100 and -1 = -100

    Now there is a line of numbers. 100 99 98 97 ... 0 ... -97 -98 -99 -100 Okay, now if you want to increase it, go little by little. so lets say 5. you would do .05. Why? Because the decimals can go out to 32(?) Places.

    So just a recap, take a number like 25 and go two places over and stick a decimal: 25 = .25
  11. Offline


    That's what I had thought, I was asking to see if anyone else had tried it yet.

    But when I test it, it won't let me use any kind of decimal :confused:

    Only -1, 0, and 1 work, and only setFlySpeed works, setWalkSpeed does nothing. And even then, 1 only makes you go hyper fast and -1 makes your movement controls inverted.

    Am I missing something here, or is this all it does?
  12. Offline


    I couldn't be bothered with looking up how the code works, but editing the and testing a few numbers I found that:
    • Walk speed is not used.
    • Fly speed is normally .05
    • Setting the fly speed to 0 will make it so the player can only move up or down
      • Anything times zero is zero
    • Setting the fly speed to 1 or -1 will make the player move very slow
      • Then it's as if there is no multiplier
    • Setting the speed higher than .5, or lower than -.5 will invert the controls
      • For regular controls the speed must be between 0.01 to 0.50, or -0.51 to -0.99
      • For inverted controls the speed must be between -0.01 to -0.50 or 0.51 to 0.99
    • For the max speed you would need to set the speed to ±0.99
  13. Offline


    to make a simple string for the walk speed do: public float = *;
    *amount u want the float to be :D
  14. Offline


    dang... i know this post is old, but it's not player.setWalkSpeed(0);
    it would be player.setWalkSpeed(0.0f); if you don't put the f, then it gets confused, the f at the end makes it a float value, which is what the javadoc calls for, so its not player.setWalkSpeed(0.5); it's player.setWalkSpeed(0.5f);
  15. Offline


    Don't grave dig a thread. Besides, the solution posted could be from older versions of the API.
Thread Status:
Not open for further replies.

Share This Page