I want to know how to keep players from placing blocks in a certain area on my Minecraft server using Command Blocks.

I already know how to keep them from breaking anything via [effect player 'mining fatigue'], but that won't stop them from placing lava, TNT, or anything that might obstruct anything important.

Any suggestions?

  • 2
    Is there any reason why it has to be vanilla?
    – Zommuter
    Commented Jul 22, 2013 at 11:05
  • @Zommuter My guess is it's for an Adventure map. Le_Beholder, could you give us some more context, such as what this is for and what situation you are wanting to use this in? Commented Jul 22, 2013 at 19:11
  • @SevenSidedDie For that they could use AdventureCraft - it's not using the most recent Minecraft features, but it allows for a pretty simple distribution of adventure maps. If a more recent Minecraft version is necessary, there's TaleCraft but it's still "in early development"
    – Zommuter
    Commented Jul 23, 2013 at 6:59
  • I am not sure but I think if you edit a beacon to give mining fatigue 100 it should work.
    – user63753
    Commented Dec 12, 2013 at 21:26
  • 3
    Possible duplicate of Is there a way to set an "Adventure Mode Boundary" in Minecraft?
    – pppery
    Commented Nov 6, 2022 at 2:27

8 Answers 8


My suggestion would be to modify the following variable in the server.properties file:


Then OP yourself and anyone else you trust to place and destroy blocks. This forces your world (or at least any realistic distance from spawn) to have spawn protection. Blocks cannot be placed or destroyed in this area, unless you're an OP (and at least one OP must be listed in order for it to work).

Note that it is currently not possible to fully prevent the griefing you described above in vanilla without tampering with the user's inventory or use of modding tools.

  • Can spawn-protection be set via Command Block?
    – Batophobia
    Commented Aug 2, 2013 at 15:06
  • No, it can only be set by modifying the server.properties file and restarting the server.
    – Gigazelle
    Commented Feb 26, 2015 at 23:14
  • This solution also prevents them from using Enchant Tables or Ender chests and so. Commented Mar 10, 2016 at 13:49

Set their gamemode to adventure mode using /gamemode <plr> adventure. This makes it so that they cannot break or place blocks.

  • 3 is spectator, 2 is adventure. I'd suggest just saying the mode itself, e.g. /gamemode player adventure. Commented Mar 14, 2016 at 20:28
  • @ZebMcCorkle Adventure used to be 3. Answer has been edited to match 1.8.
    – vex
    Commented Mar 17, 2016 at 19:04
  • Not to mention that the numeric IDs no longer work at all in 1.13
    – pppery
    Commented Aug 5, 2018 at 13:41

So long as a player has blocks or placeable items, they can place them. Therefore, the only way to prevent placing blocks is to take away a player's inventory with the clear <playername> command.

If there are only a few items you need to prevent from being used this way (e.g., you're specifically concerned about TNT and lava buckets, and nothing else), you can get more specific by using the optional [item] and [metadata] arguments of the clear command to remove only a specific type of item per command. But if not, then your only recourse is clearing their whole inventory.


To the commenter suggesting using @p and the redstone clock he demonstrated, I have two notes.

First, you are looking for @a to select all players. The selectors are as follows:

@p - selects closest player to the command block
@a - selects all players
@r - selects a random player
@e - selects all entities*

    *including hostile/friendly mobs, players, items/blocks on the ground, etc.
     it is *strongly* recommended you use modifiers to reduce the scope when
     using @e.

There are far more efficient and faster ways to build clocks, and having fewer repeaters/redstone torches etc is a bonus. The "Redstone Lag" players often experience is actually the result of block light updates, caused by these devices turning on/off. The blocks around them are lit up and dimmed with each cycle, and these lighting changes are what crush some machines.

Pure redstone and redstone blocks tend to have less or no impact on lighting. You can build an incredibly fast clock by simply placing two command blocks against one stone block. In one command block use /setblock to set a redstone block where the stone block currently is. Then, in the other command block, tell it to set the redstone block (using the setblock command) to air (minecraft:air). Lastly, replace the stone block that is adjacent to both command blocks with a redstone block manually. They will instantly start fighting each other for control of the block and an insanely fast, relatively low impact clock is produced.

I would also suggest running /gamerule commandBlockOutput False otherwise your chat will be filled with line after line of "Block Placed".

For clarity's sake, C is a command block, S is the stone block

Command: /setblock x y z minecraft:redstone_block
Command: /setblock x y z minecraft:air

both sets of x y z should be replaced with the coordinates for the S block. Use full integers, no decimal places. Alternatively, you can use relative coordinates. These are done as ~ ~ ~ instead of numbers. The three tildes (~) will run the command directly on the command blocks own coordinates. You can modify relative coordinates using positive or negative values. In the drawn example above I could use the following integers. (be sure to know which axis you're adjusting, in this case I've simply used the X axis as an example).

First: /setblock ~1 ~ ~ minecraft:redstoneblock
Second: /setblock ~-1 ~ ~ minecraft:air

This causes the command block to the left to select in the positive direction on the left axis (while maintaining the command blocs y and z). The block to the right does the exact opposite. In this example the only axis that changes is X. The advantage is we can copy this system using a command like clone, or by copying just the code, and not need to adjust the coordinates each time. It saves a lot of work.

Getting the hang of command blocks is a -big- undertaking, an

  • Is this post finished?
    – rivermont
    Commented Aug 9, 2015 at 23:51

I made a system using command blocks and scoreboard objectives that I call GriefDenial 2.0. It's available in schematic file format that you can import into your world using MCedit or other tools that understand schematic files.

This system allows any and all players to create a protected 30×30 area in which only they can build or place blocks, with the ability to add one other trusted user who can also build in their claim. Since it is built out of command blocks and scoreboard objectives, this is useful for any vanilla server.


You could, Have a command block and make a redstone loop where it goes around and around. Example: R= Redstone J= Redstone Repeaters. (Repeaters face oppisite directions) Then, light the redstone with a redstone torch, break torch, and with redstone, as quick as you can break and replace the lit redstone.


After you have made this, or something like this you need a command block. In the command block type /clear @p I think @p is it, there's some code that is everyone. So this will clear their inventories. Rapidly, so you don't have to manually do it.

  • I believe you mean @a (all) not @p (Nearest Player)
    – Jayden
    Commented Jan 8, 2019 at 6:55

use setblock and clone to place air blocks all around the area. Hook the command blocks up to a fill clock, and that should do the trick. Note:this will take a LOT of work.

  • all you would need is 3 loop command blocks to protect an area using that method, each filling the area with air replacing fire, tnt, and lava Commented Nov 29, 2016 at 6:15

Maybe set all players not within an "OP team" and within a certain radius to Adventure mode. This would mean that you could still edit the spawn, and allow for "survival zones" outside the spawn.

You must log in to answer this question.

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