NOTE: THIS CAUSES SOME LAG IN BIG QUANTITIES. KEEP IN MIND THAT WHILE USING, DO NOT EXPLODE LOTS OF TNT.
Place this to a repeating command block and set it to Always active. Last, if you dont want chat to be filled with spam, do /gamerule commandBlockOutput false
That's it!