Unique Event Problem

Discussion in 'Plugin Development' started by helix457, Apr 29, 2016.

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

    helix457

    I feel I have a very unique situation here. I'm in the process of creating a plugin that needs to check if a player falls, no matter what. PlayerMoveEvent doesn't really work if a block is just "taken out from under" a player and they fall. This also doesn't work when a player jumps in the air and falls back down after reaching the max jump height. I have the code to check if a player is falling, but not the event to trigger the check. What could I do?
     
  2. Offline

    timtower Moderator Moderator

    Moved to plugin development.
     
  3. Offline

    Lordloss

    @helix457 The best way of doing this should be checking by the playerMoveEvent where the player started and how much the y coord has changed. The only other way i know would be checking it permanently in a repeating task, which is gonna be very resource heavy.
     
  4. Offline

    Konato_K

    @helix457 What are you trying to do?

    If you want to know if they fall a certain amount of blocks (higher than 3) you can use the entity damage event and check if it's fall damage.

    If you don't want players to fall a certain area then use the PlayerMoveEvent and check if they are inside that area where they can't fall (also don't check ALL player move events, first check if the X, Y and Z are different, so you avoid high cpu usage)
     
  5. Offline

    Zombie_Striker

    @helix457
    1. Create a repeating task using Schedulers. Make it repeat every tick. (1/20 of a second)
    2. Every time it repeats, check if the Y of the player's velocity is negative.
    3. If so, do the thinks you want if the player is falling.
     
Thread Status:
Not open for further replies.

Share This Page