Player.setFlying() having issues.

Discussion in 'Plugin Development' started by ThePandaPlayer, Jun 14, 2018 at 9:42 AM.

  1. Offline


    Good day,

    I am having trouble with the Player.setFlying() method.

    My code:
    Player p = (Player) sender;
            if(p.isFlying()) {
                if(p.getGameMode().equals(GameMode.SURVIVAL)||p.getGameMode().equals(GameMode.ADVENTURE)) {
                p.sendMessage(flyHeader+ChatColor.DARK_PURPLE+"You are no longer flying.");
                return 0;
            else {
                p.sendMessage(flyHeader+ChatColor.DARK_PURPLE+"You are now flying.");
                return 0;
    Now, when I run this in any Game Mode, I do fly for a split second, then it almost instantly sets me back on the ground with no error message. I have double checked all of my installed plugins (just PEX and FAWE) and found none of them blocking flight.

    Another strange oddity is that if I am falling and I run the command, I immediately stop falling and I am flying like I expected the command to do before. What is happening?

    (Please note that the return statements are correct. I have my own special command parsing system that allows me to return error codes.)
  2. Offline


    I apologize mod for double posting, I am having a legitimate issue with no responses.
  3. @ThePandaPlayer
    Try removing all other plugins from your server. Does the problem still occur?
  4. Offline


    I have done exactly what you have told me to do.

    I still get the same strange behavior.

    When I run my /fly command, it works just fine. However, I am only flying for a split second before it immediately sets my player back on the ground. Also, the server will not allow me double jump again, (if I'm in Gamemode 0 or 2)
    even though in my code, I set Player.setAllowFlight to true. I feel like this is something with the Server.
  5. Online

    timtower Ninja on the waves Moderator

  6. Offline


    I just realized something.

    So it turns out I CAN double jump to start flying again.
    However, that is not the intended functionality.
    The intended functionality is that my /fly command will set the player flying and unable to stop.
    When the command is run again, the player will be dropped back to the ground.

    And yes @timtower it is.

    Again, sorry for double post, I really need this issue solved.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 16, 2018 at 3:21 PM
  7. Online


    Is it messaging you when you go back to the ground saying you are no longer flying?

Share This Page