After playing around a bit, I have found a workaround for the non-functioning stat
objective. It works by using Flint and Steel with a durability of 0 (i.e. Damage of 64), which are automatically given to every player that does not currently have flint and steel somewhere in his inventory.
First, set up the objective as a dummy, also set up an objective tracking whether or not a TNT was already ignited.
/scoreboard objectives add hasFlintAndSteel dummy
/scoreboard objectives add Fuse dummy
Now create a fill clock and run the following 4 commands (in this order):
/scoreboard players set @a hasFlintAndSteel 0
/scoreboard players set @a hasFlintAndSteel 1 {Inventory:[{id:minecraft:flint_and_steel}]}
/scoreboard players add @e[type=PrimedTnt] Fuse 1
/execute @e[type=PrimedTnt,score_Fuse=1] ~ ~ ~ execute @p[score_flintandsteel=0,r=5] ~ ~ ~ tellraw @a ["",{selector:@p,bold:true}," has set us up the bomb!"]
/give @a[score_flintandsteel=0] minecraft:flint_and_steel 1 64
- The first two commands determine whether a player currently has flint and steel in this clock cycle/tick.
- The third command tracks the fuse time of all primed TNT entities. It is used to execute only on newly ignited TNT.
- The forth command checks for a player who just used his flint and steel in a 5 block radius around every freshly primed TNT. If a player is found, the tellraw command is executed at that player.
- The fith command gives an almost broken flint and steel to every player without one.
Since this method requires the Flint and Steel to break, this will only work in Survival or Adventure mode. Also, there is an annoying clunk sound and particles on screen every time you use your Flint and Steel.
If not everyone in your game has access to Flint and Steel, you can use another objective to only give it to the players that do in the 5th command.
It will succesfully run the command, but when you check the commandblock you aren't standing above a wool block, so it says '[21:28:27] Failed to execute 'detect' as Heroblind55246'. Try to do something like this:
/execute @a ~ ~ ~ detect ~ ~-4 ~ minecraft:wool 15 say hi
I hope it will work!
Best Answer
To do this command, have this command in an always active repeating command block:
The
@a
part checks all players. Theif block ~ ~-1 ~ minecraft:grass_block
checks if a player is on a grass block. The last part,run summon tnt ~ ~ ~
summons a tnt at the player who was on a grass block. I hope this helps.