Checking a players location

Discussion in 'Plugin Development' started by HackintoshMan, May 5, 2013.

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

    HackintoshMan

    I know you can check their location with the onPlayerMove method, but that check fractions of movement. Is there an event that triggers only when the players block coords change?
     
  2. Offline

    ZeusAllMighty11 Retired Staff

    PlayerMoveEvent tracks from block and to block. Just only check when x y or z has changed
     
  3. Offline

    HackintoshMan

    ok……

    I can't figure it out. I have stuff trigger on player move, so if I move the mouse it fires other stuff. How can I make it fire stuff if I actually change my integer block location?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  4. Offline

    chasechocolate

    Code:java
    1. if(event.getTo().getBlockX() == event.getFrom().getBlockX && event.getTo().getBlockY() == event.getFrom().getBlockY() && event.getTo().getBlockZ() == event.getFrom().getBlockZ()){
    2. //They stayed on the same block
    3. }
     
  5. Offline

    ZeusAllMighty11 Retired Staff

    Don't track the pitch or yaw changes.

    Code:
    if(e.getTo().getX() != e.getFrom().getX() || e.getTo().getZ() != e.getFrom().getY()){
     
    }
    
    @chaschocolate

    He's not asking if they stayed on the same block.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
Thread Status:
Not open for further replies.

Share This Page