[SOLVED] Check for jumping?

Discussion in 'Plugin Development' started by emikodo, Oct 27, 2011.

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


    Is there a way to check to see if a player is jumping? I found methods to check if they are sneaking or sprinting, but can't seem to find one for jumping.. Any help would be appreciated!

    Also, when you jump does it register it as standing on an air block? For example, if I wanted to create an isJumping method (provided one does not already exist), could I check to see if I'm standing on an air block?
  2. Offline


    I bet you'll have to go for a PlayerMoveEvent, just check the y axis variation of the locations you get from the getFrom() and getTo() methods. And I guess that to make sure the player isn't in water or on a ladder you'll have to grab the block for the locations (or the ones next to them) and check what material it is.
  3. Offline


    Its not easy, nor efficient. The easiest way would be to create a scheduler running every tick and check if the y value of the player has gone up. Thats a interesting theory to check if the player is standing on air, but that would also include when they are falling. Maybe checking the yaw to counteract this?
  4. Offline


    I think you should check PLAYER_VELOCITY event.
  5. Offline


    oh..thats possible too ;)
  6. Offline


    Alright, thanks! I was considering doing something like that, but wanted to see if there were other options.

    I'm ultimately wanting to use this to develop a plugin that disables jump building, so to include falling would actually be a good thing. Would this work though? I've tried and it doesn't seem to work, but I may just be implementing it wrong..

    Ooh I didn't think of that. I'll try it out. Thanks!
  7. Offline


    PLAYER_VELOCITY_EVENT is probably your best chance.
  8. Offline


    Yep, that's how I implemented it. Thanks so much! You can check out the plugin here, if you want: NoJumpBuild
    tips48 likes this.
Thread Status:
Not open for further replies.

Share This Page