So I've been making this plugin for an SMP and there's a problem with the effects that it gives. Basically, (like arrows) you can tip swords with potion effects, and there's a problem with the Instant Damage II effect where if you spam your sword, it can kill another player very quickly (which is unintended). 2 other issues are that you can, essentially, hit players through their shields because it affects them even if their shield is up, and if the attacker takes pearl damage whilst wielding the tipped sword, they'll get affected. It's a mess that I hope to clean up mostly by myself, but I mainly need help with fixing the spam-clicking glitch. Here's the Skript I used.
If anyone can give me advice on how to fix the spam-clicking issue, that would be appreciated!
Code:
on damage:
victim is a living entity
set {_victimX} to x-coordinate of victim
set {_victimY} to y-coordinate of victim
set {_victimZ} to z-coordinate of victim
if "%lore of attacker's tool%" contains "Instant Damage":
apply instant damage 1 to the victim for 0.1 seconds
execute command "execute at @e[x=%{_victimX}%,y=%{_victimY}%,z=%{_victimZ}%,distance=..1] run particle dust 0.67 0.18 0.18 1 ~ ~1 ~ 0.3 0.5 0.3 10 30 force"
play sound "block.block.suspicious_gravel.break.break" to attacker
on damage:
victim is a living entity
set {_victimX} to x-coordinate of victim
set {_victimY} to y-coordinate of victim
set {_victimZ} to z-coordinate of victim
if "%lore of attacker's tool%" contains "Instant Damage II":
apply instant damage 2 to the victim for 0.1 seconds
execute command "execute at @e[x=%{_victimX}%,y=%{_victimY}%,z=%{_victimZ}%,distance=..1] run particle dust 0.67 0.18 0.18 1 ~ ~1 ~ 0.3 0.5 0.3 10 60 force"
play sound "block.suspicious_gravel.break" to attacker
If anyone can give me advice on how to fix the spam-clicking issue, that would be appreciated!