Check if player enters or exits the location?

Discussion in 'Plugin Development' started by shohouku, Feb 4, 2020.

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

    shohouku

    How can I check if a player enters or exits the location?

    I've tried this but it says you have exited when you enter.

    Code:
    if(p.getLocation().distance(location) <= 10) {
    System.out.println("you have entered");
    } else {
    System.out.println("you have exited");
    }
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    shohouku

    What do you mean?
     
  4. Offline

    timtower Administrator Administrator Moderator

    Add the distance to the message.
     
  5. Offline

    shohouku

    The distance is passed 10.
     
  6. Offline

    timtower Administrator Administrator Moderator

    Are you entering the right location? How are you determining everything?
     
  7. Offline

    shohouku

    When I enter it doesn't say anything but when I pass more then 10 it prints.
     
  8. Offline

    timtower Administrator Administrator Moderator

    Do you have screenshots? Terminal output? More code?
     
Thread Status:
Not open for further replies.

Share This Page