AllowFlight remove fall damage ?

Discussion in 'Plugin Development' started by *-Emax-*, Nov 20, 2013.

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

    *-Emax-*

    Hi, i have this code in my class

    Code:java
    1. @EventHandler(priority = EventPriority.HIGH)
    2. public void onPlayerMove(PlayerMoveEvent event) {
    3. Player player = event.getPlayer();
    4. if (!player.isFlying())
    5. player.setAllowFlight(true);
    6. }
    7.  
    8. @EventHandler(priority = EventPriority.MONITOR)
    9. public void setFlyOnJump(PlayerToggleFlightEvent event) {
    10. Player player = event.getPlayer();
    11.  
    12. if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
    13. player.setAllowFlight(false);
    14. player.setFlying(false);
    15. player.setVelocity(player.getLocation().getDirection().multiply(3));
    16. player.setVelocity(new Vector(player.getVelocity().getX(), 5.0D, player.getVelocity().getZ()));
    17. event.setCancelled(true);
    18. }
    19.  
    20. }


    This code work perfectly, but the player not recive fall damage when jump.
    Anybody can help me?

    Up.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  2. Offline

    Desle


    You made it so they get allowed to fly when they move, moving also includes the change of the Y coordinate,
    so the
    Doesn't really do anything..

    I don't know if this has to do with the no fall damage, but it's something..
     
  3. Offline

    valon750

    Yes, a feature of setAllowFlight(true) is that it will also disable all FallDamage, essentially like creative mode, minus the inventory change.

    It's a distinctive feature in my FlightPack plugin, which would be nice to disable.
     
Thread Status:
Not open for further replies.

Share This Page