How do I make terrain that has not been placed by a player be immune to things? Example: TNT, mining. Also, how do I make blocks that have been placed by a player able to be mined/blown up?
You could replicate this by doing three things:
- Set all players to Adventure Mode (Gamemode 2).
In adventure mode, players cannot break blocks (but can still interact with interactibles like buttons, doors and levers).
- Give every player a special item that can only break a subset of blocks.
- Make sure players only have access to the specific allowed blocks.
By restricting the block pool and giving players a tool that only allows to break them, you've effectively restricted players to whatever blocks they've placed.
Ensure the blocks you've given them has the
CanPlaceOnflag for every block.
Or you could go code your own Bukkit plugin to do that, because this is something niche (not commonly done, or if at all).
This website lets you create specific tools that can have enchantments or only able to break types of blocks.
Select the item, and then press advanced settings. Then under the Adventure mode tab you can select what blocks you can break with that tool. You must be in Adventure mode for this to work.
Alternatively you could build that spawn area somewhere else, and then use the clone command that will clone that spawn area to another location. Make sure the clone command is on an infinite loop to prevent it from being broken.