Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<Player> checkLocal(Player p, Canal cname) {
- ArrayList<Player> perto = new ArrayList<>();
- for (Player p2 : getNearbyEntities(p.getLocation(), cname.distance()))
- perto.add(p2);
- return perto;
- }
- public List<Player> getNearbyEntities(Location l, double d) {
- List<Player> f = new ArrayList<Player>();
- for (Entity entity : l.getWorld().getEntities()) {
- if (entity instanceof Player) {
- if (checkloc(l, entity.getLocation(), d)) {
- f.add((Player) entity);
- }
- }
- }
- return f;
- }
- public boolean checkloc(Location c, Location ce, double d) {
- int x = c.getBlockX(), z = c.getBlockZ();
- int x1 = ce.getBlockX(), z1 = ce.getBlockZ();
- if (x1 >= (x + d) || z1 >= (z + d) || x1 <= (x - d) || z1 <= (z - d)) {
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement