Examples of ConfigFile


Examples of de.matrixweb.smaller.config.ConfigFile

              new File(PlexusTestCase.getBasedir(), "target/smaller-" + file
                  + ".yml"));
          final File testYml = new File(PlexusTestCase.getBasedir(),
              "target/smaller-" + file + ".yml");

          final ConfigFile configFile = ConfigFile.read(testYml);
          configFile.setEnvironments(new HashMap<String, Environment>());
          for (final ProcessDescription processDescription : manifest
              .getProcessDescriptions()) {
            final Environment env = new Environment();
            env.getFiles().setFolder(new String[] { source.getAbsolutePath() });
            final List<String> names = new ArrayList<String>();
            for (final Processor proc : processDescription.getProcessors()) {
              names.add(proc.getName());
            }
            env.setPipeline(names.toArray(new String[0]));
            env.setProcess(processDescription.getOutputFile());
            for (final Processor proc : processDescription.getProcessors()) {
              final de.matrixweb.smaller.config.Processor processor = new de.matrixweb.smaller.config.Processor();
              processor.setSrc(processDescription.getInputFile());
              processor.setOptions(new HashMap<String, Object>(proc
                  .getOptions()));
              env.getProcessors().put(proc.getName(), processor);
            }
            configFile.getEnvironments().put(UUID.randomUUID().toString(), env);
          }
          configFile.getBuildServer().setEnvironments(
              configFile.getEnvironments().keySet().toArray(new String[0]));
          FileUtils.write(testYml, configFile.dumpYaml());

          FileUtils.copyFile(new File(PlexusTestCase.getBasedir(),
              "src/test/resources/smaller-maven-mojo-config.xml"), new File(
              PlexusTestCase.getBasedir(), "target/smaller-maven-mojo-config-"
                  + file + ".xml"));
View Full Code Here

Examples of de.matrixweb.smaller.config.ConfigFile

      prepareTestFiles(file, callback, new ExecuteTestCallback() {
        @Override
        public void execute(final Manifest manifest, final File source,
            final File target) throws Exception {

          final ConfigFile configFile = new ConfigFile();
          configFile.setEnvironments(new HashMap<String, Environment>());
          for (final ProcessDescription processDescription : manifest
              .getProcessDescriptions()) {
            final Environment env = new Environment();
            env.getFiles().setFolder(new String[] { source.getAbsolutePath() });
            final List<String> names = new ArrayList<String>();
            for (final Processor proc : processDescription.getProcessors()) {
              names.add(proc.getName());
            }
            env.setPipeline(names.toArray(new String[0]));
            env.setProcess(processDescription.getOutputFile());
            for (final Processor proc : processDescription.getProcessors()) {
              final de.matrixweb.smaller.config.Processor processor = new de.matrixweb.smaller.config.Processor();
              processor.setSrc(processDescription.getInputFile());
              processor.setOptions(new HashMap<String, Object>(proc
                  .getOptions()));
              env.getProcessors().put(proc.getName(), processor);
            }
            configFile.getEnvironments().put(UUID.randomUUID().toString(), env);
          }
          configFile.getBuildServer().setEnvironments(
              configFile.getEnvironments().keySet().toArray(new String[0]));
          configFile.getBuildServer().setOutputOnly(GlobalOptions.isOutOnly(manifest));
          final File testYml = new File("target/smaller-" + file + ".yml");
          FileUtils.write(testYml, configFile.dumpYaml());

          stask.setTarget(target);
          stask.setConfigFile(testYml);
          stask.execute();
        }
View Full Code Here

Examples of de.matrixweb.smaller.config.ConfigFile

      try {
        temp.delete();
        temp.mkdirs();

        log("Reading config-file: " + this.configFilePath);
        final ConfigFile configFile = ConfigFile.read(this.configFilePath);

        final List<String> includedFiles = new ArrayList<String>();
        for (final String envName : configFile.getBuildServer()
            .getEnvironments()) {
          final Environment env = configFile.getEnvironments().get(envName);
          for (final String dir : env.getFiles().getFolder()) {
            copyFirstInputFile(env, dir, temp);

            File base = new File(dir);
            if (!base.isAbsolute()) {
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

    /**
     * Fetch settings from the current default config.
     */
    private void adjustSettings() {
        final ConfigFile config = ConfigManager.getConfigFile();
        doExpireData = config.getBoolean(ConfPaths.DATA_EXPIRATION_ACTIVE);
        durExpireData = config.getLong(ConfPaths.DATA_EXPIRATION_DURATION, 1, 1000000, 60) * 60000L; // in minutes
        deleteData = config.getBoolean(ConfPaths.DATA_EXPIRATION_DATA, true); // hidden.
        deleteHistory = config.getBoolean(ConfPaths.DATA_EXPIRATION_HISTORY);
    }
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

        Bukkit.getPluginManager().callEvent(new NCPReloadEvent());

        sender.sendMessage(TAG + "Configuration reloaded!");
        final String info = "[NoCheatPlus] Configuration reloaded.";
        if (!(sender instanceof ConsoleCommandSender)) Bukkit.getLogger().info(info);
        final ConfigFile config = ConfigManager.getConfigFile();
        if (config.getBoolean(ConfPaths.LOGGING_ACTIVE) && config.getBoolean(ConfPaths.LOGGING_BACKEND_FILE_ACTIVE)) StaticLogFile.fileLogger.info(info);
    }
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

            }
            // No sub command worked, print usage.
            return false;
        }

        final ConfigFile config = ConfigManager.getConfigFile();
        if (config.getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)){
            // Prevent the NCP usage printout:
            // TODO: GetColoredString
            sender.sendMessage(ColorUtil.replaceColors(config.getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_MSG)));
            return true;
        }
        else{
            return false;
        }
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

  /**
   * Send block codes to the player according to allowed or disallowed client-mods or client-mod features.
   * @param player
   */
  public static void motdOnJoin(final Player player) {
    final ConfigFile config = ConfigManager.getConfigFile();
    if (!config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE)){
      // No message is to be sent.
      return;
    }
    // TODO: Somebody test this all !
      // TODO: add feature to check world specific (!).
 
      // Check if we allow all the client mods.
      final boolean allowAll = config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ALLOWALL);
     
      String message = "";
      for (int i = 0; i < motdS.length; i++){
        message = motdS[i].onPlayerJoin(message, player, allowAll);
      }
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

    protected void setupCommandProtection() {
        // TODO: Might re-check with plugins enabling during runtime (!).
        final List<CommandProtectionEntry> changedCommands = new LinkedList<CommandProtectionEntry>();
        // Read lists and messages from config.
        final ConfigFile config = ConfigManager.getConfigFile();
        // (Might add options to invert selection.)
        // "No permission".
        // TODO: Could/should set permission message to null here (server default), might use keyword "default".
        final List<String> noPerm = config.getStringList(ConfPaths.PROTECT_PLUGINS_HIDE_NOPERMISSION_CMDS);
        if (noPerm != null && !noPerm.isEmpty()){
            final String noPermMsg = ColorUtil.replaceColors(ConfigManager.getConfigFile().getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOPERMISSION_MSG));
            changedCommands.addAll(PermissionUtil.protectCommands(Permissions.FILTER_COMMAND, noPerm,  true, false, noPermMsg));
        }
        // "Unknown command", override the other option.
        final List<String> noCommand = config.getStringList(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_CMDS);
        if (noCommand != null && !noCommand.isEmpty()){
            final String noCommandMsg = ColorUtil.replaceColors(ConfigManager.getConfigFile().getString(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_MSG));
            changedCommands.addAll(PermissionUtil.protectCommands(Permissions.FILTER_COMMAND, noCommand,  true, false, noCommandMsg));
        }
        // Add to changes history for undoing.
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

        ConfigManager.init(this);

        // Setup file logger.
        StaticLogFile.setupLogger(new File(getDataFolder(), ConfigManager.getConfigFile().getString(ConfPaths.LOGGING_BACKEND_FILE_FILENAME)));

        final ConfigFile config = ConfigManager.getConfigFile();

        useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);

        // Initialize MCAccess.
        initMCAccess(config);

        // Initialize BlockProperties.
        initBlockProperties(config);

        // Initialize data manager.
        disableListeners.add(0, dataMan);
        dataMan.onEnable();

        // Allow entries to TickTask (just in case).
        TickTask.setLocked(false);

        // List the events listeners and register.
        manageListeners = config.getBoolean(ConfPaths.COMPATIBILITY_MANAGELISTENERS);
        if (manageListeners) {
            listenerManager.setRegisterDirectly(true);
            listenerManager.registerAllWithBukkit();
        }
        else{
            // Just for safety.
            listenerManager.setRegisterDirectly(false);
            listenerManager.clear();
        }

        @SetupOrder(priority = - 100)
        class ReloadHook implements INotifyReload{
            @Override
            public void onReload() {
                // Only for reloading, not INeedConfig.
                processReload();
            }
        }

        // Add the "low level" system components first.
        for (final Object obj : new Object[]{
                nameSetPerms,
                getCoreListener(),
                // Put ReloadListener first, because Checks could also listen to it.
                new ReloadHook(),
                NCPExemptionManager.getListener(),
                new ConsistencyChecker() {
                    @Override
                    public void checkConsistency(final Player[] onlinePlayers) {
                        NCPExemptionManager.checkConsistency(onlinePlayers);
                    }
                },
                dataMan,
        }){
            addComponent(obj);
            // Register sub-components (allow later added to use registries, if any).
            processQueuedSubComponentHolders();
        }

        // Register "higher level" components (check listeners).
        for (final Object obj : new Object[]{
                new BlockInteractListener(),
                new BlockBreakListener(),
                new BlockPlaceListener(),
                new ChatListener(),
                new CombinedListener(),
                // Do mind registration order: Combined must come before Fight.
                new FightListener(),
                new InventoryListener(),
                new MovingListener(),
        }){
            addComponent(obj);
            // Register sub-components (allow later added to use registries, if any).
            processQueuedSubComponentHolders();
        }

        // Register optional default components.
        final DefaultComponentFactory dcf = new DefaultComponentFactory();
        for (final Object obj : dcf.getAvailableComponentsOnEnable(this)){
            addComponent(obj);
            // Register sub-components to enable registries for optional components.
            processQueuedSubComponentHolders();
        }

        // Register the commands handler.
        final PluginCommand command = getCommand("nocheatplus");
        final NoCheatPlusCommand commandHandler = new NoCheatPlusCommand(this, notifyReload);
        command.setExecutor(commandHandler);
        // (CommandHandler is TabExecutor.)

        // Set up the tick task.
        TickTask.start(this);

        this.dataManTaskId  = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                dataMan.checkExpiration();
            }
        }, 1207, 1207);

        // Set up consistency checking.
        scheduleConsistencyCheckers();

        //        if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)){
        //            // Is a new update available?
        //          final int timeout = config.getInt(ConfPaths.MISCELLANEOUS_UPDATETIMEOUT, 4) * 1000;
        //          getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
        //        @Override
        //        public void run() {
        //          updateAvailable = Updates.checkForUpdates(getDescription().getVersion(), timeout);
        //        }
        //      });
        //        }

        // Is the version the configuration was created with consistent with the current one?
        configProblems = Updates.isConfigUpToDate(config);
        if (configProblems != null && config.getBoolean(ConfPaths.CONFIGVERSION_NOTIFY)){
            // Could use custom prefix from logging, however ncp should be mentioned then.
            LogUtil.logWarning("[NoCheatPlus] " + configProblems);
        }

        // Care for already online players.
View Full Code Here

Examples of fr.neatmonster.nocheatplus.config.ConfigFile

    /**
     * All action done on reload.
     */
    protected void processReload(){
        final ConfigFile config = ConfigManager.getConfigFile();
        configProblems = Updates.isConfigUpToDate(config);
        // TODO: Process registered ComponentFactory instances.
        // Set up MCAccess.
        initMCAccess(config);
        // Initialize BlockProperties
        initBlockProperties(config);
        // Reset Command protection.
        undoCommandChanges();
        if (config.getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)) {
            setupCommandProtection();
        }
        // (Re-) schedule consistency checking.
        scheduleConsistencyCheckers();
        // Cache some things.
        useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.