Solved How do I make so when players disable fly, or log offline they won't take fall damage?

Discussion in 'Spigot Plugin Development' started by Souljalex, May 17, 2018.

  1. Hello, I am having an issue how do I make it so players won't take fall damage and when they log offline they don't take fall damage.



    This is the code:


    https://hastebin.com/pefevoyahe.cpp
     
    • Funny Funny x 1
  2. Looks like it didn't work but I can try recoding it to see what I can try and make.
     
  3. but thanks for helping me out!
     
  4. It didn't work? Damn, I didn't test it xD
     
  5. A way to approach this might be using a PlayerJoinEvent, you can check if the player has a permission node (the one to use the fly command). If they do then you can set them as flying when they log into the server, this will prevent them from taking fall damage.
     
  6. On leave teleport the players to the closest block on the ground?
     
  7. Now that I have fix it so when players disable flight in the air they won't take damage, but now I need to know how to make offline players, if leave with fly enabled and log back with their fly disabled. They fall to their death so how do I fix that?
    It doesn't seem to work
     
  8. ^
     
  9. How do I do that? I have PlayerQuitEvent but not sure how to make them teleport to the nearest block.
     
  10. You could use the
    getHighestBlockAt
    method to get the highest block and teleport the player to this location.
     
    • Agree Agree x 1
  11. Okay. Thanks for helping me!
     

Share This Page