Check if player enters or exits the location?

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

  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. Online

    timtower Moderator Moderator

  3. Offline

    shohouku

    What do you mean?
     
  4. Online

    timtower Moderator Moderator

    Add the distance to the message.
     
  5. Offline

    shohouku

    The distance is passed 10.
     
  6. Online

    timtower Moderator 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. Online

    timtower Moderator Moderator

    Do you have screenshots? Terminal output? More code?
     

Share This Page