Search in sources :

Example 1 with ExemptionSettings

use of fr.neatmonster.nocheatplus.hooks.ExemptionSettings in project NoCheatPlus by NoCheatPlus.

the class NoCheatPlus method setInstanceMembers.

/**
 * Set instance members based on the given configuration. This is meant to
 * work after reloading the configuration too.
 *
 * @param config
 */
private void setInstanceMembers(final ConfigFile config) {
    configProblemsChat = ConfigManager.isConfigUpToDate(config, config.getInt(ConfPaths.CONFIGVERSION_NOTIFYMAXPATHS));
    configProblemsFile = configProblemsChat == null ? null : ConfigManager.isConfigUpToDate(config, -1);
    clearExemptionsOnJoin = config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_JOIN);
    clearExemptionsOnLeave = config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_LEAVE);
    NCPExemptionManager.setExemptionSettings(new ExemptionSettings(config));
}
Also used : ExemptionSettings(fr.neatmonster.nocheatplus.hooks.ExemptionSettings)

Example 2 with ExemptionSettings

use of fr.neatmonster.nocheatplus.hooks.ExemptionSettings in project NoCheatPlus by NoCheatPlus.

the class NoCheatPlus method setupBasics.

/**
 * Lazy initialization of basics (static API, configuration, logging).
 */
private void setupBasics() {
    // Ensure permissions are registered early.
    for (RegisteredPermission rp : Permissions.getPermissions()) {
        if (permissionRegistry.getPermissionInfo(rp.getId()) == null) {
            permissionRegistry.addRegisteredPermission(rp);
        }
    }
    // API.
    updateNoCheatPlusAPI();
    // Initialize server version.
    if (ServerVersion.getMinecraftVersion() == GenericVersion.UNKNOWN_VERSION) {
        BukkitVersion.init();
    }
    // Pre config setup.
    if (getGenericInstance(ActionFactoryFactory.class) == null) {
        // Set to default.
        setActionFactoryFactory(null);
    }
    // Configuration.
    if (!ConfigManager.isInitialized()) {
        ConfigManager.init(this, worldDataManager);
        // Basic setup for exemption (uses CheckType). This is redundant, but should not hurt.
        NCPExemptionManager.setExemptionSettings(new ExemptionSettings(ConfigManager.getConfigFile()));
    }
    // Logging.
    if (logManager == null || logManager.getStreamID(Streams.STATUS.name) != Streams.STATUS) {
        logManager = new BukkitLogManager(this);
        StaticLog.setStreamID(Streams.INIT);
        StaticLog.setUseLogManager(true);
        logManager.info(Streams.INIT, "Logging system initialized.");
        logManager.info(Streams.INIT, "Detected Minecraft version: " + ServerVersion.getMinecraftVersion());
        genericInstanceRegistry.setLogger(logManager, new IGetStreamId() {

            @Override
            public StreamID getStreamId() {
                // TODO Auto-generated method stub
                return NoCheatPlus.this.getRegistryStreamId();
            }
        }, "[GenericInstanceRegistry] ");
    }
}
Also used : StreamID(fr.neatmonster.nocheatplus.logging.StreamID) IGetStreamId(fr.neatmonster.nocheatplus.logging.details.IGetStreamId) ExemptionSettings(fr.neatmonster.nocheatplus.hooks.ExemptionSettings) RegisteredPermission(fr.neatmonster.nocheatplus.permissions.RegisteredPermission) ActionFactoryFactory(fr.neatmonster.nocheatplus.actions.ActionFactoryFactory) BukkitLogManager(fr.neatmonster.nocheatplus.logging.BukkitLogManager)

Aggregations

ExemptionSettings (fr.neatmonster.nocheatplus.hooks.ExemptionSettings)2 ActionFactoryFactory (fr.neatmonster.nocheatplus.actions.ActionFactoryFactory)1 BukkitLogManager (fr.neatmonster.nocheatplus.logging.BukkitLogManager)1 StreamID (fr.neatmonster.nocheatplus.logging.StreamID)1 IGetStreamId (fr.neatmonster.nocheatplus.logging.details.IGetStreamId)1 RegisteredPermission (fr.neatmonster.nocheatplus.permissions.RegisteredPermission)1