Solved GetVelocity not working?

Discussion in 'Plugin Development' started by Nostos, Feb 9, 2018.

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

    Nostos

    Hello, I'm developing an anticheat and so far so good :D just one problem... I want to get the player's Y velocity when they're in the air to check if they are flying. Now at first i thought "Oh, easy just do:"
    Code:
    if((player.getLocation().getBlock().getRelative(BlockFace.DOWN)).getMaterial() == Material.AIR && player.getVelocity().getY() == 0) {
    
    }
    would do it. but it doesn't, any help?
     
    Last edited: Feb 9, 2018
  2. Offline

    Lorinthio

    You want to check if they are flying? With an Elytra or just creative flying?

    I would avoid Y velocity as you could easily confuse jumping as flying :)

    Also:
    Flying = player.isFlying()
    Gliding = player.isGliding()
     
  3. Offline

    Nostos

    nope :p the idea is to catch hackers... thanks though.

    Bump

    Edit: solved another way

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Feb 11, 2018
Thread Status:
Not open for further replies.

Share This Page