Пример #1
0
 public boolean canGetNeededBlock(Player p) {
   if (neededBlock != null) {
     for (Entity e : neededBlock.getWorld().getNearbyEntities(neededBlock, 2, 2, 2)) {
       if (e == p) {
         return true;
       }
     }
     return false;
   } else {
     return false;
   }
 }
Пример #2
0
  public Area getArea(Location loc) {
    FileConfiguration locationsFile =
        YamlConfiguration.loadConfiguration(Main.getInstance().locations);
    List<Area> areas = Area.getBlockSpawns();
    int i = 0;
    for (int t = 1; t < 9; t++) {
      String[] data = locationsFile.getString("arena.blockspawnareas." + t).split(" ");

      Location minimum = locationUtil.deserializeLoc(data[0]);
      Location maximum = locationUtil.deserializeLoc(data[1]);
      for (double x = minimum.getX(); x <= maximum.getX(); x++) {
        for (double y = minimum.getY(); y <= maximum.getY(); y++) {
          for (double z = minimum.getZ(); z <= maximum.getZ(); z++) {
            Location location = new Location(minimum.getWorld(), x, y, z);
            if (location.equals(loc)) {
              return areas.get(i);
            }
          }
        }
      }
      i++;
    }
    return null;
  }