Stay Still Event

Discussion in 'Plugin Development' started by KingFaris10, Apr 15, 2013.

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

    KingFaris10

    I was wondering if there's a way to check if a player's standing still (event). Like a StandStill event, I know it's not in the Bukkit event package but is there anyway to detect if they are standing still, and if they are, do .
     
  2. Offline

    evilmidget38

    KingFaris10 There's no reason to have an event for the player not doing. We don't have events for the absence of actions, otherwise we'd have events such as "EntityNotDamagedEvent" and "EntityNotTeleportEvent". What you're trying to achieve can probably be handled via Bukkit's Scheduler. Knowing specifically what you're doing would help.
     
  3. Offline

    KingFaris10

    Thanks for the help. Now, I just thought I could have an arraylist that holds if a player is not moving (using the PlayerMoveEvent) and then have a bukkit repeated scheduler :)
     
  4. KingFaris10
    I suggest just checking player's velocity, check if that vector's x/y/z are *close* to 0, that way you can easily adjust the tolerance of movement and avoid listening to PlayerMoveEvent and avoid extra storage.
     
  5. Offline

    KingFaris10

    True, that'd reduce server usage... hmm I'll try that too and check which way's more efficient for my need.
     
  6. Offline

    bobacadodl

    Either use a scheduler to check the players velocity, or use playermoveevent and store the players last location in a hashmap, and compare their new location with their last one.
     
Thread Status:
Not open for further replies.

Share This Page