[SOLVED] Check for jumping?

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

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

    emikodo

    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

    DDoS

    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

    tips48

    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

    Ribesg

    I think you should check PLAYER_VELOCITY event.
     
  5. Offline

    tips48

    oh..thats possible too ;)
     
  6. Offline

    emikodo

    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

    tips48

    PLAYER_VELOCITY_EVENT is probably your best chance.
     
  8. Offline

    emikodo

    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