how can i get if a player on ground or not?

Discussion in 'Spigot Plugin Development' started by TheBlueKing, May 25, 2016.

  1. i want to test a player on ground,i don't want to test if the block under the player is air.how can i do it?
     
  2. Subtract 0.1 from the location then see if the block of that is air.
     
  3. MiniDigger

    Supporter

    • Agree Agree x 6
  4. Code (Java):
    if (!player.isFlying() && player.getLocation().subtract(0, 0.1, 0).getBlock().getType().isSolid() /* is that a method ? */) {
        // on ground
    }
     
    • Like Like x 1