Minecraft wiki entry for Command_blocks_and_functions, associated text: By using a condition such as /execute if entity @p[distance=..5,name=!<placing player>] run <command> hooked to a short clock and one or more TNT blocks via a comparator, the command block can act as an undetectable proximity mine against all players except the placing player.