You can do this using a scoreboard objective and Data Tags.
To check for worn items, you will need to look at {Inventory:[{Slot:Xb,...}]}
, where X is the appropriate slot, as follows: Helmet: 103, Chestplate: 102, Leggings: 101, Boots: 100. Replace the ellipsis with the items data tag, such as id:minecraft_diamond_boots
or tag:{display:{Name:"Bob"}}
(More info can be found at the wiki article on item structure).
Here's an example with jumping boots called "Rocket Boots", for both 1.9 and 1.8:
1.9
Set up a repeat/chain command block line and run
/scoreboard players tag @a[tag=jumpBoots] remove jumpBoots
/scoreboard players tag @a[tag=!jumpBoots] add jumpBoots {Inventory:[{Slot:100b,tag:{display:{Name:"Rocket Boots"}}}]}
/effect @a[tag=jumpBoots] minecraft:jump_boost 1 2 true
This will add the "jumpBoots" tag to everyone wearing "Rocket Boots". Every player with this tag gets a jump boost effect for 1 second, with magnitude 2 and without swirley particle effects.
1.8
For 1.8, you need to set up a scoreboard objective first:
/scoreboard objective add jumpBoots
You only have to do this once. Now put a some command blocks on a setblock/fill clock, and execute, in this order:
/scoreboard players set @a jumpBoots 0
/scoreboard players set @a jumpBoots 1 {Inventory:[{Slot:100b,tag:{display:{Name:"Rocket Boots"}}}]}
/effect @a[score_jumpBoots_min=1] minecraft:jump_boost 1 2 true
Since tags don't exist in 1.8, we use a scoreboard that is set to 0 or 1 depending on whether or not a player is wearing the boots.
As of 1.9, potions no longer use the Damage
value to determine type of potion and whether or not it's a splash potion. Instead, the ID has been split into minecraft:potion
and minecraft:splash_potion
(along with minecraft:lingering_potion
introduced in 1.9), while the effect itself is stored in the Potion
string tag:
/give @p minecraft:splash_potion 1 0 {Potion:"minecraft:strong_healing",display:{Name:"Grenade"}}
You can find a list of default brew IDs here.
Best Answer
The simplest way you can do this is have a fast clock, but don't check if there is a player that has died. Instead, just put your Minecraft username there and it will keep giving you the potion effect even after you die. E.g. (gives jump boost 2 to player with name 'username'):
Alternatively, if you want this to work with any two people, have a scoreboard objective and set it to 1 for the player to receive the potion effect. Then give the player with a score of 1 for that objective the potion effect with a really fast clock.
Hope this helped you!