use of fr.neatmonster.nocheatplus.permissions.PermissionPolicy 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