Solved setflyspeed

Discussion in 'Plugin Development' started by Nooobui, Feb 21, 2016.

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

    Nooobui

    hello bukkit I was testing out flying stuff and noticed setFlySpeed() did not seem to change the players flight speed? Does this not work or am I using it wrong?

    p.setAllowFlight(true);
    p.setFlying(true);
    p.setFlightSpeed(1.0F);
     
  2. Offline

    Xerox262

    @Nooobui From what I remember 1 is the default fly speed, try setting it to something higher or lower.
     
    Nooobui likes this.
  3. Offline

    Zombie_Striker

    @Nooobui
    If I remember correctly, because of changes made in 1.8+ with the ability to "sprint" while flying they either removed the "flightspeed", or bukkit/spigot broke flightspeed. (Most likely in is the former)
     
    Nooobui likes this.
  4. Offline

    Nooobui

    @Xerox262 trying to set above 1 throws a error in console it's max

    @Zombie_Striker damn ok ty for letting me know why it doesn't work

    Anyone have a idea how to to make a player fly faster w/o setFlySpeed
     
  5. Offline

    Lightspeed

    ((CraftPlayer)p).getHandle().abilities.flySpeed = 2F;
    Somthing like this using a players abilities c:
    Ill edit it once I get the 100% correct awnser.


    Edit: OHHH I got it right first try this works until you go at your servers max speed limit.
    Also be carful as this does not reset when the player disconnects.
    Meaning I now fly around at lightspeeds cause I'm too lazy to add 1 line of code to reset it/change it.
     
    Nooobui and ChipDev like this.
  6. Offline

    Graffetus

    I think you problem is that your using a capital "F".
     
  7. Offline

    N00BHUN73R

    @Graffetus
    Using a lower case or capital F for float has nothing to do with the issue..
    I'm pretty sure 1.8+ breaks the flight speed since they implemented sprinting while flying, aka pressing CTRL when flying you go super fast...

    but

    @Lightspeed's code works perfect :)
     
  8. Offline

    Konato_K

    @Graffetus Whether is capital or not it doesn't matter, 1D, 1d and 1.0 are exactly the same thing.
     
Thread Status:
Not open for further replies.

Share This Page