How do I disable players from building/placing blocks in a certain area of minecraft server?

I want players in my minecraft server to be unable to break and place blocks right near the spawn. Then after they pass the limits they can start building things. How do I do this?


In your server.properties file, there is a line which specifies spawn protection. It determines the radius of the spawn protection. Setting this to 0 will not disable spawn protection. 0 will protect the single block at the spawn point. 1 will protect a 3x3 area centered on the spawn point. 2 will protect 5x5, 3 will protect 7x7, etc. This option is not generated on the first server start and appears when the first player joins. If there are no ops set on the server, the spawn protection will be disabled automatically.

The correct syntax for the rule should be spawn-protection=16 where 16 is the radius you desire. To be certain you're using the correct format, however, you could set yourself as op and join the server, if you haven't already done so, which will generate the default setting (16) for spawn protection, then you can change it if you like.

In Windows, your server.properties file will be in the same directory as Minecraft_Server.exe. In Linux, it will be in the path of working directory. See the wiki article.

More information can be found on the Minecraft wiki


Additionally, an alternative way of protecting regions that are not just close to spawn is using a modded server running Spigot and WorldGuard.

WorldGuard is a plugin that you can add to a Spigot server to protect specific regions and grant particular permissions to some players. For example, if you wanted to protect a region that was 10,000 blocks away from spawn, you would be able to manually define a region (using WorldEdit, a dependency of WorldGuard), define it as a region, and grant it particular flags, such as whether or not PvP is allowed, if fire is allowed to spread and burn blocks, if mobs can spawn naturally, and a large number of other things.

Typically, WorldGuard is often used with a permissions plugin, so that way, some users are allowed to place blocks in a region while others are not. You could also accomplish this with just OP or non-OP permissions as well, but sometimes using a more intricate permissions set-up is preferential depending on your needs.

This is certainly more difficult than just modifying the server.properties file, but as a result, you get a lot more flexibility, power, and options to customize the region protection as you see fit. Playing around with Minecraft servers are one the things I enjoy most, and you can actually learn a lot by doing things such as this.

For a full list of all the WorldGuard region flags, you can look here.