I'm making a Minecraft 1.16 datapack and I need to check if a player is in a certain location. I want to check for that condition every tick and then run a function when it is met.
I'm currently using this command:
execute as @a[x = 10, y = 56, z = 42, dx = 8, dy = 10, dz = 0] run say Passed
The problem is that when the condition is met, the
run say Passed part also executes every tick, which is not what I want.
When the condition is met, I want that command to only run once, and not every tick, while still checking the condition every tick. But, I also want the command to be able to run again after a second or so.
Could I do this by checking the condition every tick, then running a function that has a timer that only executes a command if it was previously executed 1 or more seconds ago?