private void registerOrThrow ( AddOnModel addOn , String permissionMessage ) throws IzouSoundPermissionException { Function < PluginDescriptor , Boolean > checkPlayPermission = descriptor -> { if ( descriptor . getAddOnProperties ( ) == null ) throw new IzouPermissionException ( "addon_config.properties not found for addon:" + addOn ) ; try { return descriptor . getAddOnProperties ( ) . getProperty ( "audio_output" ) != null && descriptor . getAddOnProperties ( ) . getProperty ( "audio_output" ) . trim ( ) . equals ( "true" ) && descriptor . getAddOnProperties ( ) . getProperty ( "audio_usage_descripton" ) != null && ! descriptor . getAddOnProperties ( ) . getProperty ( "audio_usage_descripton" ) . trim ( ) . equals ( "null" ) && ! descriptor . getAddOnProperties ( ) . getProperty ( "audio_usage_descripton" ) . trim ( ) . isEmpty ( ) ; } catch ( NullPointerException e ) { return false ; } } ; registerOrThrow ( addOn , ( ) -> new IzouSoundPermissionException ( permissionMessage ) , checkPlayPermission ) ; }
registers the AddOn or throws the Exception