Enabling fall damage in flying mode

Discussion in 'Plugin Development' started by Chloe-chan, Jan 27, 2016.

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

    Chloe-chan

    Greetings!

    I want to know if there is a way to re-enable fall damage for players when they are in fly mode, aka when they are in
    Code:
    player.setAllowFlight(true);
    . Regardless if the player is flying before they should take fall damage, the event EntityDamageEvent is not triggered.

    Thanks in advance!
     
  2. Offline

    Zombie_Striker

    @Chloe-chan
    The reason it is not triggered is because if the player has the ability to fly, they should not be damaged. One way to get around this is to either setAllowFlight to false when they are falling close to the ground. You can also make a repeating task that check if a player is falling, and if the player lands on the ground, apply the damage.
     
  3. Offline

    Chloe-chan

    That sounds like a pretty big workaround... I'll probably give up on this idea then. :p
     
  4. Offline

    teej107

    Check if the players fall distance is 3 or above, if they are like half a block above ground, and if they are flying in the PlayerMoveEvent. If conditions are met, set flying to false
     
  5. Offline

    Chloe-chan

    I'll try it out! Thanks anyways!
     
Thread Status:
Not open for further replies.

Share This Page