Minecraft – What player actions can be specifically tracked by command blocks

minecraft-commandsminecraft-java-edition

I want to target a specific player when they do an action such as open a door, step on a pressure plate, press a button, etc.

Currently, using @p on a pressure plate directly over a command block is not good enough, as another player can actually stand closer to the command block by standing in the center of the pressure plate.

If I were to do a
/testfor ~ ~1 ~ stone_button 9
that only tracks if the button is pressed, but I then can't use @s in anothe command block to do an action on the press of the button.

So my question is, what actions can a player perform which I can then target them with using @s?

Best Answer

Using commands you can check for everything that is tracked by the scoreboard (see https://minecraft.gamepedia.com/Scoreboard#Criteria) or trackable through advancement triggers (https://minecraft.gamepedia.com/Advancements#List_of_triggers).

sadly, none of the things you mentioned (open door, step on pressure plate, click button) are trackable at this point.
(which is also why mapmakers often use clickable signs instead of buttons so they know which player clicked it)