Search in sources :

Example 1 with DefaultConfig

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

the class TestWorldDataManager method set.

/**
 * Set in the config taken from the map - create if not yet existent.
 *
 * @param map
 * @param worldName
 * @param key
 * @param value
 */
void set(Map<String, ConfigFile> map, String worldName, String key, Object value) {
    ConfigFile cfg = map.get(worldName);
    if (cfg == null) {
        cfg = new DefaultConfig();
        map.put(worldName, cfg);
    }
    cfg.set(key, value);
}
Also used : ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile) DefaultConfig(fr.neatmonster.nocheatplus.config.DefaultConfig)

Example 2 with DefaultConfig

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

the class TestActions method testOptimizedLogActionEmpty.

@Test
public void testOptimizedLogActionEmpty() {
    PluginTests.setUnitTestNoCheatPlusAPI(false);
    PermissionRegistry pReg = NCPAPIProvider.getNoCheatPlusAPI().getPermissionRegistry();
    final ConfigFile config = new DefaultConfig();
    config.set("actions", "log:dummy:0:0:icf");
    config.set("strings.dummy", "dummy");
    config.set(ConfPaths.LOGGING_ACTIVE, false);
    ActionList actionList = config.getOptimizedActionList("actions", pReg.getOrRegisterPermission("dummy"));
    Action<ViolationData, ActionList>[] actions = actionList.getActions(0.0);
    if (actions.length != 0) {
        fail("Wrong number of actions.");
    }
}
Also used : Action(fr.neatmonster.nocheatplus.actions.Action) ConfigFile(fr.neatmonster.nocheatplus.config.ConfigFile) DefaultConfig(fr.neatmonster.nocheatplus.config.DefaultConfig) ActionList(fr.neatmonster.nocheatplus.actions.ActionList) PermissionRegistry(fr.neatmonster.nocheatplus.permissions.PermissionRegistry) Test(org.junit.Test)

Example 3 with DefaultConfig

use of fr.neatmonster.nocheatplus.config.DefaultConfig 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)

Aggregations

ConfigFile (fr.neatmonster.nocheatplus.config.ConfigFile)3 DefaultConfig (fr.neatmonster.nocheatplus.config.DefaultConfig)3 Action (fr.neatmonster.nocheatplus.actions.Action)1 ActionList (fr.neatmonster.nocheatplus.actions.ActionList)1 PermissionRegistry (fr.neatmonster.nocheatplus.permissions.PermissionRegistry)1 Test (org.junit.Test)1