Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public ArrayList<Player> checkLocal(Player p, Canal cname) {
  2. ArrayList<Player> perto = new ArrayList<>();
  3. for (Player p2 : getNearbyEntities(p.getLocation(), cname.distance()))
  4. perto.add(p2);
  5. return perto;
  6. }
  7.  
  8. public List<Player> getNearbyEntities(Location l, double d) {
  9. List<Player> f = new ArrayList<Player>();
  10. for (Entity entity : l.getWorld().getEntities()) {
  11. if (entity instanceof Player) {
  12. if (checkloc(l, entity.getLocation(), d)) {
  13. f.add((Player) entity);
  14. }
  15. }
  16. }
  17. return f;
  18. }
  19.  
  20. public boolean checkloc(Location c, Location ce, double d) {
  21. int x = c.getBlockX(), z = c.getBlockZ();
  22. int x1 = ce.getBlockX(), z1 = ce.getBlockZ();
  23.  
  24. if (x1 >= (x + d) || z1 >= (z + d) || x1 <= (x - d) || z1 <= (z - d)) {
  25. return false;
  26. }
  27. return true;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement