Is there a way to testfor players at multiple coordinates with one command?

For example, I want to test for players on a specific row of z and y (only x changes)

/testfor @a[149,30,298,1] 
/testfor @a[148,30,298,1] 
/testfor @a[147,30,298,1] 
/testfor @a[146,30,298,1] 
/testfor @a[145,30,298,1]

and so on...

is there a way to put this into one command instead of placing many commandblocks for each one?


Solution 1:

You can set a specific radius in the testfor command like this: testfor @a[x=...,y=...,z=...,r=<radius>].

You can also test for players in a box: testfor @a[x=10,y=10,z=10,dx=5,dy=5,dz=5] will select a box from coordinates [10, 10, 10] to [15, 15, 15].