@Override protected void parse() { defaultScript = getConfig().getString(PARAM_DEFAULT_SCRIPT, ""); defaultDir = getConfig().getString(PARAM_DEFAULT_DIR, ""); try { List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()).configurationsAt(ALL_SCRIPTS_KEY); this.scripts = new HashSet<>(fields.size()); List<String> tempListNames = new ArrayList<>(fields.size()); for (HierarchicalConfiguration sub : fields) { String name = sub.getString(SCRIPT_NAME_KEY, ""); try { if (!"".equals(name) && !tempListNames.contains(name)) { tempListNames.add(name); File file = new File(sub.getString(SCRIPT_FILE_KEY)); if (!file.exists()) { logger.error("Script '" + file.getAbsolutePath() + "' does not exist"); continue; } ScriptWrapper script = new ScriptWrapper( sub.getString(SCRIPT_NAME_KEY), sub.getString(SCRIPT_DESC_KEY), sub.getString(SCRIPT_ENGINE_KEY), sub.getString(SCRIPT_TYPE_KEY), sub.getBoolean(SCRIPT_ENABLED_KEY), file); script.setLoadOnStart(true); // Because it was saved ;) scripts.add(script); } } catch (Exception e) { logger.error("Error while loading the script: " + name, e); } } } catch (Exception e) { logger.error("Error while loading the scripts: " + e.getMessage(), e); } try { this.scriptDirs = new ArrayList<File>(); for (Object dirName : getConfig().getList(SCRIPT_DIRS)) { File f = new File((String) dirName); if (!f.exists() || !f.isDirectory()) { logger.error("Not a valid script directory: " + dirName); } else { scriptDirs.add(f); } } } catch (Exception e) { logger.error("Error while loading the script dirs: " + e.getMessage(), e); } confirmRemoveDir = getConfig().getBoolean(SCRIPT_CONFIRM_REMOVE_DIR, true); }