I was wondering if there was a way to test for players breaking a specific block, such as dirt. After they break the block, they die.
Answer
Set up an objective of the type you want, for example:
/scoreboard objectives add BreakDirt stat.mineBlock.minecraft.dirt
Then, on a clock and in this order, have the following commands:
/kill @a[score_BreakDirt_min=1]
/scoreboard players set @a[score_BreakDirt_min=1] BreakDirt 0
The first command kills anyone who has broken dirt, the second command sets their score back to 0 so they don’t die repeatedly.
Attribution
Source : Link , Question Author : ReaLord , Answer Author : SirBenet