The perfect choice of one-stop service for diversification of architecture.
Then we have a clock running these commands 24/7
Then we have 1CB, followed by a comparator, 2CB followed by a comparator, 3CB, followed by a comparator.
Then at the end of the comparator we have a redstone string that inputs a signal to a redstone torch.
The redstone torch is connected to a wire of redstone which goes to a command block that resets the scoreboard (/scoreboard players set @pscore_damage_min1 damage 0) so the command can operator more than one time. You can do all sorts of stuff with the execute command, one of my favorite being that you when you replace the effect slowness with heal. In a nutshell it tests if you are holding (in slot 0) A sword named Poisoned blade > then it tests if you have done damage > finally it executes a command (effect) and then resets the score for further use.
I'm not the most experienced person when it comes to commands. I worked out how to do stuff like when holding x you have y effect. I wanted to think of something that gave other people an effect when hit. Here is what I came up with but I got stuck when it said it couldn't execute the command.
/scoreboard objective add nokill dummy
/scoreboard objective add poi dummy
/scoreboard players set [player] nokill 1
/scoreboard players add @a poi 1 SelectedItem:id:minecraft:diamond_sword,display:Name:Poison sword
/execute @a[score_poi_min1] /effect @p[score_nokill_max1,r5] HurtTime:1 minecraft:poison 10 1
·OTHER ANSWER:
I'm not the most experienced person when it comes to commands. I worked out how to do stuff like when holding x you have y effect. I wanted to think of something that gave other people an effect when hit. Here is what I came up with but I got stuck when it said it couldn't execute the command.
/scoreboard objective add nokill dummy
/scoreboard objective add poi dummy
/scoreboard players set [player] nokill 1
/scoreboard players add @a poi 1 SelectedItem:id:minecraft:diamond_sword,display:Name:Poison sword
/execute @a[score_poi_min1] /effect @p[score_nokill_max1,r5] HurtTime:1 minecraft:poison 10 1