tag @s add SpellUpdate

tellraw @s[tag=!ImbueSpell,tag=!ImbueSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:7s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have unlocked the Blood Imbue spell! It is located on page 43 of your spellbook.","color":"dark_aqua"}]
tellraw @s[tag=ImbueSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:7s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have already unlocked this spell! It is located on page 43 of your spellbook.","color":"aqua"}]
tag @s[tag=!ImbueSpell,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:7s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] add ImbueSpell
clear @s[tag=ImbueSpell,tag=!ImbueSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:7s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] paper{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:7s}],display:{Lore:["\"Unlocks a spell when held.\""]}} 1
tag @s[tag=ImbueSpell,tag=!ImbueSpell2] add ImbueSpell2
#
tellraw @s[tag=!RageSpell,tag=!RageSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:8s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have unlocked the Blind Rage spell! It is located on page 44 of your spellbook.","color":"dark_aqua"}]
tellraw @s[tag=RageSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:8s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have already unlocked this spell! It is located on page 44 of your spellbook.","color":"aqua"}]
tag @s[tag=!RageSpell,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:8s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] add RageSpell
clear @s[tag=RageSpell,tag=!RageSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:8s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] paper{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:8s}],display:{Lore:["\"Unlocks a spell when held.\""]}} 1
tag @s[tag=RageSpell,tag=!RageSpell2] add RageSpell2
#
tellraw @s[tag=!BasicRevSpell,tag=!BasicRevSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:9s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have unlocked the Basic Revive spell! It is located on page 32 of your spellbook.","color":"dark_aqua"}]
tellraw @s[tag=BasicRevSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:9s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have already unlocked this spell! It is located on page 32 of your spellbook.","color":"aqua"}]
tag @s[tag=!BasicRevSpell,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:9s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] add BasicRevSpell
clear @s[tag=BasicRevSpell,tag=!BasicRevSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:9s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] paper{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:9s}],display:{Lore:["\"Unlocks a spell when held.\""]}} 1
tag @s[tag=BasicRevSpell,tag=!BasicRevSpell2] add BasicRevSpell2
#
tellraw @s[tag=!ResurrectSpell,tag=!ResurrectSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have unlocked the Resurrect spell! It is located on page 33 of your spellbook.","color":"dark_aqua"}]
tellraw @s[tag=ResurrectSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] ["",{"text":"You have already unlocked this spell! It is located on page 33 of your spellbook.","color":"aqua"}]
tag @s[tag=!ResurrectSpell,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] add ResurrectSpell
clear @s[tag=ResurrectSpell,tag=!ResurrectSpell2,nbt={SelectedItem:{tag:{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],display:{Lore:["\"Unlocks a spell when held.\""]}}}}] paper{HideFlags:1,Enchantments:[{id:"minecraft:unbreaking",lvl:10s}],display:{Lore:["\"Unlocks a spell when held.\""]}} 1
tag @s[tag=ResurrectSpell,tag=!ResurrectSpell2] add ResurrectSpell2
#
tag @s[tag=SpellUpdate] add BookUpdate
tag @s[tag=SpellUpdate,nbt=!{SelectedItem:{id:"minecraft:paper",tag:{HideFlags:1,Enchantments:[{}]}}}] remove SpellUpdate