I would like to have commands constantly working in my spawn chunks, but in a certain area of my world I would like those commands not to have any effects on me.

Is there a way to make so commands won't work on you in a given area?

1 Answer 1


There's not really an automated way to do that, as in setting a gamerule when you're in the area or something.

What you can do, is set up a scoreboard objective based on whether you are or are not in the exempt area, and manually add it to the appropriate target selectors in your commands.

Set up a scoreboard objective:

/scoreboard objectives add disableCommands dummy

Now, place a repeat/chain command block line and have it run

/scoreboard players set @a disableCommands 0
/scoreboard players set @a[x=X,y=Y,z=Z,dx=DX,dy=DY,dz=DZ] disableCommands 1

where X, Y, Z is one corner of your area, and DX, DY, DZ is the size. If your area has a strange shape, you can simply use the second command again with different coordinates. You can then use score_disableCommands=0 as an additional target selector argument for your main commands, e.g.:

/effect @a[tag=speed,score_disableCommands=0] minecraft:speed 1 1

Note that a scoreboard objective is better suited for this than a tag, even though the latter is easier to set up. That's because you cannot (easily) test for more than one tag in a target selector, but you can test for more than one score.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .