options:
duration: 5 #duration can't be longer than cooldown
cooldown: 20 #or else the effects will never stop
#as long as you keep hitting them.
function giveswords(p: player):
set {_names::*} to "&cNether", "&3Deepdark", "&6Earth", "&eAether" and "&bEnd"
loop size of {_names::*} times:
give {_p} unbreakable netherite sword of sharpness 5 named "%{_names::%loop-number%}% Sword"
wait 1 tick
command giveswords [<player>]:
permission: *
trigger:
arg is not set:
giveswords(player)
else:
giveswords(arg)
on damage:
name of attacker's tool contains "&cNether", "&3Deepdark", "&6Earth", "&eAether" or "&bEnd":
attacker has attacker's tool on cooldown:
stop
else:
set item cooldown of attacker's tool for attacker to {@cooldown} seconds
name of attacker's tool contains "&cNether":
apply haste 6 without particles to attacker for {@duration} seconds
apply wither 2 without particles to victim for {@duration} seconds
else if name of attacker's tool contains "&3Deepdark":
apply strength 3 without particles to attacker for {@duration} seconds
apply weakness 2 without particles to victim for {@duration} seconds
else if name of attacker's tool contains "&6Earth":
apply spped 3 without particles to attacker for {@duration} seconds
apply mining fatigue 2 without particles to victim for {@duration} seconds
else if name of attacker's tool contains "&eAether":
apply instant health 2 without particles to attacker for {@duration} seconds
apply slow falling 1 without particles to victim for {@duration} seconds
else if name of attacker's tool contains "&bEnd":
apply regeneration 2 without particles to attacker for {@duration} seconds
apply slowness 3 without particles to attacker for {@duration} seconds