Solved Infinite Elytra Flight

Discussion in 'Plugin Development' started by MisterMel, Mar 1, 2017.

Thread Status:
Not open for further replies.
  1. Hello everybody, its me, Mario! No, actually, its me, MisterMel.
    So im creating a minigame where players have to use their elytra to fly around, and i want them
    to be able to fly upwards. I dindt find a good way to do this, so does anybody how to do it?
    - MisterMel (No, not Mario)
     
  2. @MisterMel
    * Check if the player is using it
    * If the player is using the elytra, then enable fly. if not, return

    Wouldnt this work? Im not sure if there is an custom event for the elytra since i havent tried programming with anything newer than 1.8
     
  3. No, that doesnt work. .setAllowFlight doesnt actually influence flying with the elytra.
     
  4. Offline

    MrGeneralQ

    The way I would do this:

    In the PlayerMoveEvent I would check if the player is gliding, then I would use velocity to gain more speed again. How is up to you
     
    MisterMel likes this.
  5. @MrGeneralQ
    Thank you! This works. The way im doing it is as follows: (For other people that have the same problem)
    Code:
        @EventHandler
        public void onPlayerMove(PlayerMoveEvent e) {
            if(e.getPlayer().isGliding()) {
                e.getPlayer().setVelocity(e.getPlayer().getLocation().getDirection().multiply(0.7f));
            }
        }
    
    I still have to play around with the speed for a bit, but this works pretty good.
     
    MrGeneralQ likes this.
  6. Offline

    MrGeneralQ

    Glad I could help :) Please mark your post as solved
     
  7. @MrGeneralQ
    Woops, sorry forgot to do that. Marked it as solved now.
     
  8. Offline

    MrGriefer_

    @MisterMel
    I know your question has been solved, but I found this! It might help you.
     
Thread Status:
Not open for further replies.

Share This Page