What command can I use to locate tnt in a players inventory? [duplicate]
You are unable to locate an item in a shulker box or enderchest - this will require game file editing.
Using commands, you are able to clear their inventory of tnt, or link any other command.
First, custom command if tnt is found:
execute at @a[nbt={Inventory:[{id:"minecraft:tnt"}]}] run <Your command here>
If you would like for no player to have tnt in their inventory, run
clear @a tnt
every tick (using a repeating command block)