public boolean checkforPlayers(int area) {
java.util.List<Player> playerss = players.getAll();
for (Player p : playerss) {
if (myPlayer().getArea(area).contains(p) && !p.getName().equals(myPlayer().getName())) {
return true;
}
}
return false;
}
Returns true if there's players around your area. (excluding yourself)
I use this generally like this:
if(checkforPlayers(7) && random(0,25) == 0){
/* do world hop*/
}