Guest User

Untitled

a guest
Jul 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /**
  2. * Checks if the player is in a given rectangle.
  3. *
  4. * @author Alekz
  5. *
  6. * @param lowX - The X coord of the south-westerly corner of the rectangle.
  7. * @param lowY - The Y coord of the south-westerly corner of the rectangle.
  8. * @param highX - The X coord of the north-easterly corner of the rectangle.
  9. * @param highY - The Y coord of the north-easterly corner of the rectangle.
  10. */
  11.  
  12. public boolean playerInRect(int lowX, int lowY, int highX, int highY) {
  13. int X = getMyPlayer().getLocation().getX();
  14. int Y = getMyPlayer().getLocation().getY();
  15. if (X >= lowX && X <= highX && Y >= lowY && Y <= highY)
  16. return true;
  17. else
  18. return false;
  19. }
Add Comment
Please, Sign In to add comment