Exemple #1
0
 /**
  * Pour construire une courbe constante
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @param s le syntagme associe
  */
 public Courbe(Syntagme s) {
   this(
       s,
       Integer.parseInt(ConfigFile.rechercher("FREQUENCE_INIT")),
       -1,
       Integer.parseInt(ConfigFile.rechercher("HAUTEUR_PALIER")));
 }
Exemple #2
0
 /**
  * Calcul du point suivant, pour une courbe de type B
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @return la valeur ad'hoc
  */
 private int valueB() {
   double d = (double) (xn - nbPoint);
   return (int)
       (frequenceInit
           + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_B")) * hauteurNiveau
           + coeffk * Math.pow(d, Integer.parseInt(ConfigFile.rechercher("PUISSANCE_B"))));
 }
 @Before
 public void startupDatabase() {
   ConfigFile configFileAnnotation = getClass().getAnnotation(ConfigFile.class);
   assert configFileAnnotation != null;
   Database.ensureStarted(new File(configFileAnnotation.value()));
   db = new Database(SecurityManager.SYSTEM_USER);
   wipeDatabase();
   ListenerManager.configureTriggerDispatcher(db); // config file gets erased by command above
 }
Exemple #4
0
 /**
  * Calcul du point suivant, pour une courbe de type E
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @return la valeur ad'hoc
  */
 private int valueE() {
   return (int)
       (frequenceInit
           + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_E")) * hauteurNiveau
           - Integer.parseInt(ConfigFile.rechercher("COEFF_H_N-1_E"))
               * hauteurNiveau
               * (xn - 1)
               / (nbPoint - 1));
 }
Exemple #5
0
 /**
  * Pour lire un texte court (sans ponctuation) à voix haute
  *
  * @param text, chaîne de caractères à lire à voix haute
  */
 public void playShortText(String text) {
   if (!on) return;
   an = new Analyser(text, prosodie);
   Vector<Phoneme> listePhonemes = an.analyserGroupes();
   s =
       new SynthetiseurMbrola(
           lt.getVoix(),
           ConfigFile.rechercher("REPERTOIRE_PHO_WAV"),
           ConfigFile.rechercher("FICHIER_PHO_WAV"));
   s.play();
   sjoue = true;
 }
Exemple #6
0
 /**
  * Calcul du point suivant, pour une courbe de type C
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @return la valeur ad'hoc
  */
 private int valueC() {
   double r =
       Math.pow(
           (double) (xn - 1) / (nbPoint - 1),
           Integer.parseInt(ConfigFile.rechercher("PUISSANCE_C")));
   return (int)
       (frequenceInit
           + Integer.parseInt(ConfigFile.rechercher("COEFF_HAUTEUR_C")) * hauteurNiveau
           - Integer.parseInt(ConfigFile.rechercher("COEFF_H_SQRT_C"))
               * hauteurNiveau
               * Math.sqrt(1 - r));
 }
Exemple #7
0
 // appelé par loopText et playText avec valeur flagloop différente
 public void play(String text, boolean flagloop) {
   if (!on) return;
   an = new Analyser(text, prosodie);
   Vector<Phoneme> listePhonemes = an.analyserGroupes();
   s =
       new SynthetiseurMbrola(
           lt.getVoix(),
           ConfigFile.rechercher("REPERTOIRE_PHO_WAV"),
           ConfigFile.rechercher("FICHIER_PHO_WAV"));
   // System.out.println("RAPIDITE: "+ConfigFile.rechercher("RAPIDITE"));
   if (flagloop) s.loop();
   else s.play();
   sjoue = true;
 }
Exemple #8
0
 /**
  * Constructeur par defaut
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @param s le syntagme associe a la courbe
  * @param f la frequence initiale de la courbe
  * @param n le nombre de points utilise par la courbe
  * @param h la hauteur entre les 4 niveaux des courbes
  */
 public Courbe(Syntagme s, int f, int n, int h) {
   synt = s;
   frequenceInit = f;
   nbPoint = n;
   hauteurNiveau = h;
   if (s.mineur())
     coeffk =
         -(Integer.parseInt(ConfigFile.rechercher("COEFF_K_MINEUR")) * h) / Math.pow(1 - n, 2);
   else if (s.majeur())
     coeffk =
         -(Integer.parseInt(ConfigFile.rechercher("COEFF_K_MAJEUR")) * h) / Math.pow(1 - n, 2);
   else coeffk = 0;
   xn = 0;
 }
  private void setupClasses() {

    ActionBar.nmsver = Bukkit.getServer().getClass().getPackage().getName();
    ActionBar.nmsver = ActionBar.nmsver.substring(ActionBar.nmsver.lastIndexOf(".") + 1);
    plugin = this;
    Glow.register();
    ms = new Messages();
    getMessagesFile().loadMessagesConfiguration();
    cfile = new ConfigFile();
    cfile.loadConfigFile();
    ub = new UtilBlock();
    uis = new UtilItemStack();
    upt = new UtilParticleType();
    mn = new MenuManager();
    pm = new ParticlesMenu();
    u = new UtilItem();
    dm = new DisguiseMenu();
    spm = new SuperMenu();
    gdt = new Gadgets();
    ul = new UtilLocations();
    petsm = new PetMenu();
    mountn = new MountMenu();
    hm = new HatsMenu();
    trampGadget = new Trampolim();
    popper = new PartyPopper();
  }
Exemple #10
0
 /**
  * Pour fixer la voix utilisée si la synthèse parle
  *
  * @param voix, de 1 à 7
  */
 public void setVoix(int voix) {
   int vox;
   int nbvoix =
       Integer.parseInt(
           ConfigFile.rechercher("NBVOIX")); // nombre de voix disponibles dans ressources
   System.out.println(nbvoix);
   vox = (voix > nbvoix) ? nbvoix : voix;
   vox = (voix < 1) ? 1 : voix;
   lt.setVoix(vox);
 }
Exemple #11
0
 /**
  * Constructeur pour fixer la voix
  *
  * @param voix, de 1 à 7 pour fr1, fr2, ... fr7
  */
 public SIVOXDevint(int voix) {
   int vox;
   int nbvoix = Integer.parseInt(ConfigFile.rechercher("NBVOIX")); // nombre de voix disponibles
   System.out.println(nbvoix);
   jk = null;
   sjoue = false;
   on = true;
   prosodie = 3; // la meilleure prosodie
   vox = (voix > nbvoix) ? nbvoix : voix;
   vox = (voix < 1) ? 1 : voix;
   lt.setVoix(vox);
 }
Exemple #12
0
 /**
  * Pour obtenir la prochaine valeur de la courbe (iterateur)
  *
  * @author Ecole Polytechnique de Sophia Antipolis
  * @return l'entier correspondant
  */
 public int nextValue() {
   if (xn == -1) {
     if (synt.finExclam())
       return frequenceInit
           + Integer.parseInt(ConfigFile.rechercher("COEFF_EXCLAMATION")) * hauteurNiveau;
     else return frequenceInit + hauteurNiveau;
   } else {
     xn++;
     if (synt.mineur()) return valueA();
     if (synt.majeur()) return valueB();
     if (synt.finInterro()) return valueC();
     if (synt.finExclam()) return valueE();
     return valueD();
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.setup_server);
    Button testBtn = (Button) findViewById(R.id.sbTest);
    testBtn.setOnClickListener(this);

    mapp = (MeltdownApp) getApplication();
    auth = new ConfigFile(this);

    if (mapp.isAppConfigured()) {
      TextView tv = (TextView) findViewById(R.id.sServerUrl);
      tv.setText(auth.getURL());
    }
  }
  @Override
  public void onClick(View v) {
    // Pull values out of view and save
    String url, email, password;
    TextView tv = (TextView) findViewById(R.id.sServerUrl);
    url = tv.getText().toString();
    tv = (TextView) findViewById(R.id.sEmail);
    email = tv.getText().toString();
    tv = (TextView) findViewById(R.id.sPass);
    password = tv.getText().toString();

    auth.setConfig(url, email, password);

    if (mapp.isAppConfigured() && mapp.checkLogin()) {
      Toast.makeText(SetupServerActivity.this, "Logged in OK!", Toast.LENGTH_SHORT).show();
      mapp.startUpdates();
      SetupServerActivity.this.finish();
    } else
      Toast.makeText(
              SetupServerActivity.this, "Login error, please correct data", Toast.LENGTH_LONG)
          .show();
  }
  /**
   * Instantiates a new user preferences wrapper.
   *
   * @param context The application context.
   */
  @SuppressWarnings("deprecation")
  @SuppressLint("InlinedApi")
  @TargetApi(17)
  public GlobalPrefs(Context context) {
    AppData appData = new AppData(context);
    mPreferences = PreferenceManager.getDefaultSharedPreferences(context);

    // Locale
    mLocaleCode = mPreferences.getString(KEY_LOCALE_OVERRIDE, DEFAULT_LOCALE_OVERRIDE);
    mLocale = TextUtils.isEmpty(mLocaleCode) ? Locale.getDefault() : createLocale(mLocaleCode);
    Locale[] availableLocales = Locale.getAvailableLocales();
    String[] values = context.getResources().getStringArray(R.array.localeOverride_values);
    String[] entries = new String[values.length];
    for (int i = values.length - 1; i > 0; i--) {
      Locale locale = createLocale(values[i]);

      // Get intersection of languages (available on device) and (translated for Mupen)
      if (ArrayUtils.contains(availableLocales, locale)) {
        // Get the name of the language, as written natively
        entries[i] = WordUtils.capitalize(locale.getDisplayName(locale));
      } else {
        // Remove the item from the list
        entries = (String[]) ArrayUtils.remove(entries, i);
        values = (String[]) ArrayUtils.remove(values, i);
      }
    }
    entries[0] = context.getString(R.string.localeOverride_entrySystemDefault);
    mLocaleNames = entries;
    mLocaleCodes = values;

    // Files
    userDataDir = mPreferences.getString("pathGameSaves", "");
    galleryCacheDir = userDataDir + "/GalleryCache";
    coverArtDir = galleryCacheDir + "/CoverArt";
    unzippedRomsDir = galleryCacheDir + "/UnzippedRoms";
    profilesDir = userDataDir + "/Profiles";
    crashLogDir = userDataDir + "/CrashLogs";
    coreUserDataDir = userDataDir + "/CoreConfig/UserData";
    coreUserCacheDir = userDataDir + "/CoreConfig/UserCache";
    hiResTextureDir =
        coreUserDataDir + "/mupen64plus/hires_texture/"; // MUST match what rice assumes natively
    romInfoCache_cfg = galleryCacheDir + "/romInfoCache.cfg";
    controllerProfiles_cfg = profilesDir + "/controller.cfg";
    touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg";
    emulationProfiles_cfg = profilesDir + "/emulation.cfg";
    customCheats_txt = profilesDir + "/customCheats.txt";

    // Plug-ins
    audioPlugin = new Plugin(mPreferences, appData.libsDir, "audioPlugin");

    // Library prefs
    isRecentShown = mPreferences.getBoolean("showRecentlyPlayed", true);
    isFullNameShown = mPreferences.getBoolean("showFullNames", true);

    // Touchscreen prefs
    isTouchscreenFeedbackEnabled = mPreferences.getBoolean("touchscreenFeedback", false);
    isTouchscreenAnimated = mPreferences.getBoolean("touchscreenAnimation", false);
    touchscreenScale = ((float) mPreferences.getInt("touchscreenScale", 100)) / 100.0f;
    touchscreenTransparency = (255 * mPreferences.getInt("touchscreenTransparency", 100)) / 100;
    touchscreenSkin =
        appData.touchscreenSkinsDir + "/" + mPreferences.getString("touchscreenStyle", "Outline");
    touchscreenAutoHold = getSafeInt(mPreferences, "touchscreenAutoHold", 0);

    // Xperia PLAY touchpad prefs
    isTouchpadEnabled =
        appData.hardwareInfo.isXperiaPlay && mPreferences.getBoolean("touchpadEnabled", true);
    isTouchpadFeedbackEnabled = mPreferences.getBoolean("touchpadFeedback", false);
    touchpadSkin = appData.touchpadSkinsDir + "/Xperia-Play";
    ConfigFile touchpad_cfg = new ConfigFile(appData.touchpadProfiles_cfg);
    ConfigSection section = touchpad_cfg.get(mPreferences.getString("touchpadLayout", ""));
    if (section != null) touchpadProfile = new Profile(true, section);
    else touchpadProfile = null;

    // Video prefs
    displayOrientation = getSafeInt(mPreferences, "displayOrientation", 0);
    displayPosition = getSafeInt(mPreferences, "displayPosition", Gravity.CENTER_VERTICAL);
    int transparencyPercent = mPreferences.getInt("displayActionBarTransparency", 50);
    displayActionBarTransparency = (255 * transparencyPercent) / 100;
    isFpsEnabled = mPreferences.getBoolean("displayFps", false);
    int selectedHardwareType = getSafeInt(mPreferences, "videoHardwareType", -1);
    isPolygonOffsetHackEnabled = selectedHardwareType > -2;
    videoHardwareType =
        selectedHardwareType < 0 ? appData.hardwareInfo.hardwareType : selectedHardwareType;
    switch (videoHardwareType) {
      case HardwareInfo.HARDWARE_TYPE_OMAP:
        videoPolygonOffset = 0.2f;
        break;
      case HardwareInfo.HARDWARE_TYPE_OMAP_2:
        videoPolygonOffset = -1.5f;
        break;
      case HardwareInfo.HARDWARE_TYPE_QUALCOMM:
        videoPolygonOffset = -0.2f;
        break;
      case HardwareInfo.HARDWARE_TYPE_IMAP:
        videoPolygonOffset = -0.001f;
        break;
      case HardwareInfo.HARDWARE_TYPE_TEGRA:
        videoPolygonOffset = -2.0f;
        break;
      case HardwareInfo.HARDWARE_TYPE_UNKNOWN:
        videoPolygonOffset = -1.5f;
        break;
      default:
        videoPolygonOffset =
            SafeMethods.toFloat(mPreferences.getString("videoPolygonOffset", "-1.5"), -1.5f);
        break;
    }
    isImmersiveModeEnabled = mPreferences.getBoolean("displayImmersiveMode", false);

    // Audio prefs
    audioSwapChannels = mPreferences.getBoolean("audioSwapChannels", false);
    audioSDLSecondaryBufferSize = getSafeInt(mPreferences, "audioSDLBufferSize", 2048);
    audioSLESSecondaryBufferSize = getSafeInt(mPreferences, "audioSLESBufferSize", 1024);
    audioSLESSecondaryBufferNbr = getSafeInt(mPreferences, "audioSLESBufferNbr", 2);

    if (audioPlugin.enabled)
      isFramelimiterEnabled = mPreferences.getBoolean("audioSynchronize", true);
    else isFramelimiterEnabled = !mPreferences.getString("audioPlugin", "").equals("nospeedlimit");

    // User interface modes
    String navMode = mPreferences.getString("navigationMode", "auto");
    if (navMode.equals("bigscreen")) isBigScreenMode = true;
    else if (navMode.equals("standard")) isBigScreenMode = false;
    else
      isBigScreenMode =
          AppData.IS_OUYA_HARDWARE
              || appData.isAndroidTv; // TODO: Add other systems as they enter market
    isActionBarAvailable = AppData.IS_HONEYCOMB && !isBigScreenMode;

    // Peripheral share mode
    isControllerShared = mPreferences.getBoolean("inputShareController", false);

    // Determine the key codes that should not be mapped to controls
    boolean volKeysMappable = mPreferences.getBoolean("inputVolumeMappable", false);
    List<Integer> unmappables = new ArrayList<Integer>();
    unmappables.add(KeyEvent.KEYCODE_MENU);
    if (AppData.IS_HONEYCOMB) {
      // Back key is needed to show/hide the action bar in HC+
      unmappables.add(KeyEvent.KEYCODE_BACK);
    }
    if (!volKeysMappable) {
      unmappables.add(KeyEvent.KEYCODE_VOLUME_UP);
      unmappables.add(KeyEvent.KEYCODE_VOLUME_DOWN);
      unmappables.add(KeyEvent.KEYCODE_VOLUME_MUTE);
    }
    unmappableKeyCodes = Collections.unmodifiableList(unmappables);

    // Determine the pixel dimensions of the rendering context and view surface
    {
      // Screen size
      final WindowManager windowManager =
          (WindowManager) context.getSystemService(android.content.Context.WINDOW_SERVICE);
      Display display = windowManager.getDefaultDisplay();
      int stretchWidth;
      int stretchHeight;
      if (display == null) {
        stretchWidth = stretchHeight = 0;
      } else if (AppData.IS_KITKAT && isImmersiveModeEnabled) {
        DisplayMetrics metrics = new DisplayMetrics();
        display.getRealMetrics(metrics);
        stretchWidth = metrics.widthPixels;
        stretchHeight = metrics.heightPixels;
      } else {
        stretchWidth = display.getWidth();
        stretchHeight = display.getHeight();
      }

      float aspect = 0.75f; // TODO: Handle PAL
      boolean isLetterboxed = ((float) stretchHeight / (float) stretchWidth) > aspect;
      int zoomWidth = isLetterboxed ? stretchWidth : Math.round((float) stretchHeight / aspect);
      int zoomHeight = isLetterboxed ? Math.round((float) stretchWidth * aspect) : stretchHeight;
      int cropWidth = isLetterboxed ? Math.round((float) stretchHeight / aspect) : stretchWidth;
      int cropHeight = isLetterboxed ? stretchHeight : Math.round((float) stretchWidth * aspect);

      int hResolution = getSafeInt(mPreferences, "displayResolution", 0);
      String scaling = mPreferences.getString("displayScaling", "zoom");
      if (hResolution == 0) {
        // Native resolution
        if (scaling.equals("stretch")) {
          videoRenderWidth = videoSurfaceWidth = stretchWidth;
          videoRenderHeight = videoSurfaceHeight = stretchHeight;
        } else if (scaling.equals("crop")) {
          videoRenderWidth = videoSurfaceWidth = cropWidth;
          videoRenderHeight = videoSurfaceHeight = cropHeight;
        } else // scaling.equals( "zoom") || scaling.equals( "none" )
        {
          videoRenderWidth = videoSurfaceWidth = zoomWidth;
          videoRenderHeight = videoSurfaceHeight = zoomHeight;
        }
      } else {
        // Non-native resolution
        switch (hResolution) {
          case 720:
            videoRenderWidth = 960;
            videoRenderHeight = 720;
            break;
          case 600:
            videoRenderWidth = 800;
            videoRenderHeight = 600;
            break;
          case 480:
            videoRenderWidth = 640;
            videoRenderHeight = 480;
            break;
          case 360:
            videoRenderWidth = 480;
            videoRenderHeight = 360;
            break;
          case 240:
            videoRenderWidth = 320;
            videoRenderHeight = 240;
            break;
          case 120:
            videoRenderWidth = 160;
            videoRenderHeight = 120;
            break;
          default:
            videoRenderWidth = Math.round((float) hResolution / aspect);
            videoRenderHeight = hResolution;
            break;
        }
        if (scaling.equals("zoom")) {
          videoSurfaceWidth = zoomWidth;
          videoSurfaceHeight = zoomHeight;
        } else if (scaling.equals("crop")) {
          videoSurfaceWidth = cropWidth;
          videoSurfaceHeight = cropHeight;
        } else if (scaling.equals("stretch")) {
          videoSurfaceWidth = stretchWidth;
          videoSurfaceHeight = stretchHeight;
        } else // scaling.equals( "none" )
        {
          videoSurfaceWidth = videoRenderWidth;
          videoSurfaceHeight = videoRenderHeight;
        }
      }
    }
  }
Exemple #16
0
  private Engine(ConfigFile config) throws FileNotFoundException, IncompatibleArgumentException {
    outBuffer = new ArrayList<>(8);
    irHardware = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    config
        .getIrHardware()
        .stream()
        .forEach(
            (GirsHardware hw) -> {
              irHardware.put(hw.getName(), hw);
            });

    modules = new TreeMap<>();

    // Set up the special modules
    registerModule(Parameters.newParameterModule());

    // May override values in the code
    Parameters.getInstance().addAll(config.getOptions());

    Parameters.getInstance()
        .add(
            new StringParameter(
                "hardwareList",
                Utils.sortedString(irHardware.keySet(), " "),
                "List of available hardware"));

    registerModule(Base.newBase());

    try {
      renderer = new Renderer(Parameters.getInstance().getString(Parameters.IRPPROTOCOLSINI));
      registerModule(renderer);
    } catch (NoSuchParameterException ex) {
      logger.log(
          Level.WARNING,
          Parameters.IRPPROTOCOLSINI + " not defined; rendering will not be available");
    }

    if (config.getRemoteCommandsDataBase() != null)
      registerModule(NamedRemotes.newNamedRemotes(config.getRemoteCommandsDataBase()));

    irp = new Irp();
    registerModule(irp);

    registerModule(Transmit.newTransmit(renderer, irp));
    registerModule(Transmitters.newTransmittersModule());
    registerModule(Capture.newCapture());
    registerModule(Receive.newReceive());

    config
        .getModuleList()
        .stream()
        .forEach(
            (module) -> {
              try {
                registerModule(module.instantiate());
              } catch (ClassNotFoundException
                  | NoSuchMethodException
                  | InstantiationException
                  | IllegalAccessException
                  | IllegalArgumentException
                  | InvocationTargetException ex) {
                logger.log(Level.SEVERE, null, ex);
              }
            });

    irHardware
        .values()
        .forEach(
            (GirsHardware ghw) -> {
              if (ghw.isImmediateOpen()) {
                ghw.getHardware().setVerbosity(isVerbosity());
                try {
                  ghw.getHardware().open();
                } catch (HarcHardwareException | IOException ex) {
                  logger.log(Level.WARNING, null, ex);
                }
              }
            });
  }
  /** @param featuresXml */
  private void generate(FeaturesXml featuresXml) throws Exception {
    // Add the repositories
    if (this.repositories != null) {
      for (String repo : repositories) {
        featuresXml.addRepository(repo);
      }
    }

    // Collect all dependencies (bundle candidates)
    ScopeArtifactFilter filter = new ScopeArtifactFilter(DefaultArtifact.SCOPE_RUNTIME);
    DependencyNode dependencyGraph = dependencyGraphBuilder.buildDependencyGraph(project, filter);
    CollectingDependencyNodeVisitor collectingVizzy = new CollectingDependencyNodeVisitor();
    dependencyGraph.accept(collectingVizzy);
    List<DependencyNode> nodes = collectingVizzy.getNodes();

    // Iterate all features
    for (Feature feature : features) {
      getLog().info("Generating feature '" + feature.getName() + "'"); // $NON-NLS-1$ //$NON-NLS-2$
      // Create the feature
      featuresXml.addFeature(feature.getName(), feature.getVersion(), feature.getComment());
      // Add any feature dependencies
      List<Feature> onFeatures = feature.getDependsOnFeatures();
      if (onFeatures != null && !onFeatures.isEmpty()) {
        for (Feature onFeature : onFeatures) {
          getLog()
              .info(
                  "   Depends on feature: "
                      + onFeature.getName()
                      + "/"
                      + onFeature.getVersion()); // $NON-NLS-1$ //$NON-NLS-2$
          featuresXml.addFeatureDependency(
              feature.getName(), feature.getVersion(), onFeature.getName(), onFeature.getVersion());
        }
      }
      // Add any included or non-excluded bundles (from artifact
      // dependency graph)
      PatternIncludesArtifactFilter includesFilter =
          new PatternIncludesArtifactFilter(feature.getIncludes());
      PatternExcludesArtifactFilter excludesFilter =
          new PatternExcludesArtifactFilter(feature.getExcludes());
      String startLevel = feature.getStartLevel();
      for (DependencyNode dependencyNode : nodes) {
        if (isSelf(dependencyNode)) continue;
        Artifact artifact = dependencyNode.getArtifact();
        // If no includes, assume everything
        boolean includeBundle = feature.getIncludes() == null || feature.getIncludes().isEmpty();
        if (includeBundle) {
          getLog()
              .debug(
                  "   Artifact "
                      + artifact
                      + " matches default [all] filter (including)."); //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (includesFilter.include(artifact)) {
          getLog()
              .debug(
                  "   Artifact "
                      + artifact
                      + " matched include filter (including)."); //$NON-NLS-1$ //$NON-NLS-2$
          includeBundle = true;
        }
        // Excludes must be explicit.
        if (!excludesFilter.include(artifact)) {
          getLog()
              .debug(
                  "   Artifact "
                      + artifact
                      + " matched exclude filter (excluding)."); //$NON-NLS-1$ //$NON-NLS-2$
          includeBundle = false;
        }

        if (includeBundle) {
          featuresXml.addBundle(
              feature.getName(),
              feature.getVersion(),
              formatArtifactAsBundle(artifact),
              startLevel);
        }
      }

      // Add additional explicit bundles specified in the config
      List<String> bundles = feature.getBundles();
      if (bundles != null && !bundles.isEmpty()) {
        for (String bundle : bundles) {
          getLog().debug("   Adding explicit bundle: " + bundle); // $NON-NLS-1$
          featuresXml.addBundle(feature.getName(), feature.getVersion(), bundle, startLevel);
        }
      }

      // Add config files if any are specified in the pom
      List<ConfigFile> configFiles = feature.getConfigFiles();
      if (configFiles != null && !configFiles.isEmpty()) {
        for (ConfigFile configFile : configFiles) {
          getLog().debug("   Adding config file: " + configFile.getValue()); // $NON-NLS-1$
          featuresXml.addConfigFile(
              feature.getName(),
              feature.getVersion(),
              configFile.getFinalName(),
              configFile.getValue());
        }
      }
    }
  }
  /**
   * Initializes the configuration manager.
   *
   * @param plugin the instance of NoCheatPlus
   */
  public static void init(final NoCheatPlus plugin) {
    // First try to obtain and parse the global configuration file.
    final File folder = plugin.getDataFolder();
    final File globalFile = new File(folder, "config.yml");

    final ConfigFile global = new ConfigFile();
    global.setDefaults(new DefaultConfig());
    global.options().copyDefaults(true);
    global.options().copyHeader(true);

    if (globalFile.exists())
      try {
        global.load(globalFile);
      } catch (final Exception e) {
        e.printStackTrace();
      }

    try {
      global.save(globalFile);
    } catch (final Exception e) {
      e.printStackTrace();
    }

    global.regenerateActionLists();

    // Put the global configuration file on the configurations map.
    worldsMap.put(null, global);

    final Logger logger = Logger.getAnonymousLogger();
    logger.setLevel(Level.INFO);
    logger.setUseParentHandlers(false);
    for (final Handler h : logger.getHandlers()) logger.removeHandler(h);

    if (fileHandler != null) {
      fileHandler.close();
      logger.removeHandler(fileHandler);
      fileHandler = null;
    }

    final File logFile = new File(folder, global.getString(ConfPaths.LOGGING_FILENAME));
    try {
      try {
        logFile.getParentFile().mkdirs();
      } catch (final Exception e) {
        e.printStackTrace();
      }
      fileHandler = new FileHandler(logFile.getCanonicalPath(), true);
      fileHandler.setLevel(Level.ALL);
      fileHandler.setFormatter(LogFileFormatter.newInstance());

      logger.addHandler(fileHandler);
    } catch (final Exception e) {
      e.printStackTrace();
    }

    CheckUtils.fileLogger = logger;

    // Try to find world-specific configuration files.
    final HashMap<String, File> worldFiles = new HashMap<String, File>();

    if (folder.isDirectory())
      for (final File file : folder.listFiles())
        if (file.isFile()) {
          final String filename = file.getName();
          if (filename.matches(".+_config.yml$")) {
            final String worldname = filename.substring(0, filename.length() - 10);
            worldFiles.put(worldname, file);
          }
        }

    for (final Entry<String, File> worldEntry : worldFiles.entrySet()) {
      final File worldConfigFile = worldEntry.getValue();
      final ConfigFile world = new ConfigFile();
      world.setDefaults(global);

      try {
        world.load(worldConfigFile);
        worldsMap.put(worldEntry.getKey(), world);

        // Write the configuration file back to disk immediately.
        world.save(worldConfigFile);
      } catch (final Exception e) {
        System.out.println(
            "[NoCheatPlus] Couldn't load world-specific configuration for "
                + worldEntry.getKey()
                + "!");
        e.printStackTrace();
      }

      world.regenerateActionLists();
    }
  }