clear @s minecraft:enchanted_book[custom_data={ebooklvl1:tag}] 1
advancement revoke @s only survivalplus:tools/ebook/lvl1
execute if data entity @s {Inventory:[{id:"minecraft:enchanted_book",components:{"minecraft:custom_data":{ebooklvl1:tag}}}]} run advancement grant @s only survivalplus:tools/ebook/lvl1