I know using barrier blocks makes it so people can't break stuff, but how can I make it so players cannot place stuff at spawn?
3 Answers
You could use 2 repeating command blocks. One that sets all nearby players' gamemode to Adventure then one that sets players outside of that nearby radius to Survival.
Make sure they're near one another.
Command block 1: gamemode a @a[r=<your radius>]
Command block 2: gamemode s @a[rm=<your radius>]
After checking the wiki there seems to be some sort of volume selector which you could use to create a custom shape.
https://minecraft.wiki/w/Target_selectors#Target_selector_arguments
Mine down a bit and clear an area below spawn. Run the command /give @s deny
Place these deny blocks at whatever Y level you want, under any blocks you don't want interacted with. That's all you need to do!
To a player who is not op'ed, and in survival, it will be like they are in adventure mode. There are no Commands required, and they can interact with the rest of the world like normal. You can place these where ever you want and nothing above the block can be broken or placed.
These are better than commands because you don't need to really on ping, the shape is easily customizable, rather than having a specific radius.
Any blocks under your deny blocks can be interacted with as per usual based on the player's regular permissions, but above them, nothing.
You could try using /clone x,0,z x,255,y 30000,0,30000 to copy the area somewhere else then using a repeating command block /clone 30000,0,30000 30000+x,255,30000+y x,0,z the area back in every few seconds so it will delete what they have built.