Can I completely prevent destroying blocks in adventure mode?
I am trying to make a vanilla worldguard using command blocks in Minecraft 1.4. In 1.3, players couldn't do anything while in adventure mode. Is there any way to put players in 1.3-style adventure mode?
Solution 1:
The Mining Fatigue status effect at level 5 will completely prevent breaking blocks. Applying it to all players for a million seconds (12 days) will probably be plenty, and you can do that without mods by using a command block with the command
/effect @a 4 1000000 5
Make that trigger somehow at the beginning of your map, or on a slow timer, and you're good.
This won't prevent block breaking in Creative mode, but any Adventure or Survival mode players will be unable to break anything. (To get a command block type /give @p 137
.)
Solution 2:
The difference between 1.4 and 1.3 is that, as mentioned above, blocks can be broken with their appropriate tools. If you're making your players start out with nothing, then they'll never be able to break blocks. Unless you give them tools from a chest or dispenser or whatnot...
If you are giving your players resources, you'll have to be careful not to give any resources that they can use to make tools. To break stone, they'll need a pickaxe. To break sand, they'll need a shovel, etc. Tools are always made from sticks and either wood, cobble, gold or diamond. So, if you take care, you can make sure your players will never have the tools to make a shovel or pickaxe or sword.
One method you could try is having a chest of, say, shovels in a world of stone, with passages filled with gravel or dirt. Then, the players can interact in the world while still being constrained to the stone construction.
Also, I think this bears warning: players in adventure mode can place any block in the world. This can cause trouble if they can't break it.
If you're truly paranoid about players being able to ruin your world, just make sure that they start with absolutely no tools or tool materials, and that there's no way for them to access those materials.
Depending on your map, it might also be a good idea to look at the /gamerule
commands. In particular, /gamerule mobGriefing
and /gamerule doTileDrops
are useful ones to look at, if a player tries to get a creeper to harvest wood for 'em.
Tl;dr: Good level design will make sure your players will never have the tools to take apart your world.