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);
}
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();
}
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();
}
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);
}
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);
}
}
Aggregations