So this is my skript, pretty much it will keep on looping until {_n} is 1... I have no clue why...
Code:
on damage:
if attacker is player:
if victim is player:
if victim is not attacker:
set {_e::*} to enchantments of attacker's tool
if "%{_e::*}%" contains "Knockback" or "punch":
if slot 8 of victim's inventory is an eye of ender:
set {_l} to lore of slot 8 of victim's inventory
replace all "&7Uses: &d&n" in {_l} with ""
set {_n} to {_l} parsed as integer
remove 1 from {_n}
broadcast "%{_n}%"
if {_n} > 0:
set slot 8 of victim's inventory to eye of ender of mending 1 named "&d&lCHARM &8| &5Anti-Knockback" with lore "&7Uses: &d&n%{_n}%"
cancel event
make attacker damage victim by damage
send "&d&lCHARMS &8| &7%victim% has used their anti-knockback charm." to attacker
send "&d&lCHARMS &8| &7You have used your anti-knockback charm! &7Uses: &d&n%{_n}%" to victim
stop