Search in sources :

Example 1 with IGetStreamId

use of fr.neatmonster.nocheatplus.logging.details.IGetStreamId 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

ActionFactoryFactory (fr.neatmonster.nocheatplus.actions.ActionFactoryFactory)1 ExemptionSettings (fr.neatmonster.nocheatplus.hooks.ExemptionSettings)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