flag &= enchantment.isAllowedOnBooks();
Nothing else here is needed.