Search in sources :

Example 16 with ConfigFile

use of fr.neatmonster.nocheatplus.config.ConfigFile in project NoCheatPlus by NoCheatPlus.

the class NoCheatPlus method processReload.

/**
 * All action done on reload.
 */
private void processReload() {
    final ConfigFile config = ConfigManager.getConfigFile();
    setInstanceMembers(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. TODO: Where is this comment from !?
    // Re-setup allViolationsHook.
    allViolationsHook.setConfig(new AllViolationsConfig(config));
    // Set block change tracker.
    updateBlockChangeTracker(config);
}
Also used : ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile) AllViolationsConfig(fr.neatmonster.nocheatplus.hooks.allviolations.AllViolationsConfig)

Example 17 with ConfigFile

use of fr.neatmonster.nocheatplus.config.ConfigFile in project NoCheatPlus by NoCheatPlus.

the class WorldDataManager method createDefaultWorldData.

private void createDefaultWorldData() {
    lock.lock();
    if (worldDataMap.containsKey(null)) {
        lock.unlock();
        return;
    }
    ConfigFile config = rawConfigurations.get(null);
    if (config == null) {
        config = new DefaultConfig();
    }
    worldDataMap.put(null, new WorldData(null, this));
    updateWorldData(null, config);
    lock.unlock();
}
Also used : ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile) DefaultConfig(fr.neatmonster.nocheatplus.config.DefaultConfig)

Example 18 with ConfigFile

use of fr.neatmonster.nocheatplus.config.ConfigFile in project NoCheatPlus by NoCheatPlus.

the class ChatListener method onReload.

@Override
public void onReload() {
    // Read some things from the global config file.
    ConfigFile config = ConfigManager.getConfigFile();
    initFilters(config);
    text.onReload();
    logins.onReload();
}
Also used : ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile)

Example 19 with ConfigFile

use of fr.neatmonster.nocheatplus.config.ConfigFile in project NoCheatPlus by NoCheatPlus.

the class Text method init.

private void init() {
    // Set some things from the global config.
    final ConfigFile config = ConfigManager.getConfigFile();
    final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
    if (engine != null) {
        engine.clear();
        api.removeComponent(engine);
    }
    engine = new LetterEngine(config);
    api.addComponent(engine);
}
Also used : NoCheatPlusAPI(fr.neatmonster.nocheatplus.components.NoCheatPlusAPI) LetterEngine(fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine) ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile)

Example 20 with ConfigFile

use of fr.neatmonster.nocheatplus.config.ConfigFile in project NoCheatPlus by NoCheatPlus.

the class PlayerDataManager method adjustSettings.

/**
 * Fetch settings from the current default config.
 */
private void adjustSettings() {
    final ConfigFile config = ConfigManager.getConfigFile();
    doExpireData = config.getBoolean(ConfPaths.DATA_EXPIRATION_ACTIVE);
    // in minutes
    durExpireData = config.getLong(ConfPaths.DATA_EXPIRATION_DURATION, 1, 1000000, 60) * 60000L;
    // hidden.
    deleteData = config.getBoolean(ConfPaths.DATA_EXPIRATION_DATA, true);
    deleteHistory = config.getBoolean(ConfPaths.DATA_EXPIRATION_HISTORY);
    // TODO: Per world permission registries: need world configs (...).
    Set<RegisteredPermission> changedPermissions = null;
    try {
        // TODO: Only update if changes are there - should have a config-path hash+size thing (+ setting).
        changedPermissions = permissionRegistry.updateSettings(PermissionSettings.fromConfig(config, ConfPaths.PERMISSIONS_POLICY_DEFAULT, ConfPaths.PERMISSIONS_POLICY_RULES));
    } catch (Exception e) {
        StaticLog.logSevere("Failed to read the permissions setup. Relay to ALWAYS policy.");
        StaticLog.logSevere(e);
        permissionRegistry.updateSettings(new PermissionSettings(null, null, new PermissionPolicy()));
    }
    // Invalidate all already fetched permissions.
    for (final Entry<UUID, PlayerData> entry : playerData.iterable()) {
        entry.getValue().adjustSettings(changedPermissions);
    }
}
Also used : ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile) PermissionSettings(fr.neatmonster.nocheatplus.permissions.PermissionSettings) RegisteredPermission(fr.neatmonster.nocheatplus.permissions.RegisteredPermission) UUID(java.util.UUID) PermissionPolicy(fr.neatmonster.nocheatplus.permissions.PermissionPolicy)

Aggregations

ConfigFile (fr.neatmonster.nocheatplus.config.ConfigFile)20 IPostRegisterRunnable (fr.neatmonster.nocheatplus.components.registry.feature.IPostRegisterRunnable)4 Test (org.junit.Test)4 DefaultConfig (fr.neatmonster.nocheatplus.config.DefaultConfig)3 Player (org.bukkit.entity.Player)3 RawConfigFile (fr.neatmonster.nocheatplus.config.RawConfigFile)2 AllViolationsConfig (fr.neatmonster.nocheatplus.hooks.allviolations.AllViolationsConfig)2 RegisteredPermission (fr.neatmonster.nocheatplus.permissions.RegisteredPermission)2 IPlayerData (fr.neatmonster.nocheatplus.players.IPlayerData)2 LinkedHashMap (java.util.LinkedHashMap)2 Action (fr.neatmonster.nocheatplus.actions.Action)1 ActionFactory (fr.neatmonster.nocheatplus.actions.ActionFactory)1 ActionFactoryFactory (fr.neatmonster.nocheatplus.actions.ActionFactoryFactory)1 ActionList (fr.neatmonster.nocheatplus.actions.ActionList)1 BlockBreakListener (fr.neatmonster.nocheatplus.checks.blockbreak.BlockBreakListener)1 BlockInteractListener (fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener)1 BlockPlaceListener (fr.neatmonster.nocheatplus.checks.blockplace.BlockPlaceListener)1 ChatListener (fr.neatmonster.nocheatplus.checks.chat.ChatListener)1 LetterEngine (fr.neatmonster.nocheatplus.checks.chat.analysis.engine.LetterEngine)1 CombinedListener (fr.neatmonster.nocheatplus.checks.combined.CombinedListener)1