I need everyone playing the map to be automatically set to adventure mode. How? What is the command?

  • 2
    From the previous question you posted in, apparently /gamemode 2 should do it. Have you tried that? – Frank Oct 29 '12 at 17:04
  • 1
    Is this on a dedicated server? Or on a LAN type game? On a dedicated server you can use gamemode=2 in the server.properties file and that will affect all future players as well. – Kurley Oct 30 '12 at 8:43
  • 1
    Or /defaultgamemode 2 should work – jrtc27 Oct 31 '12 at 18:35

Unfortunately, there is no real command to set everyone to a gamemode. You would have to have a command block with the command:

/gamemode 2

And then have all the players hit a button or something to activate the block when they spawn. You could, perhaps, have a spawn room with an iron door, and hook the button to open the door up to a command block.

EDIT: Apparently you can also use

/gamemode 2 @a

To set all players to gamemode 2 (adventure mode).

  • 13
    If you use gamemode 2 @a it will run the command for all players. – Ronan Oct 29 '12 at 17:25
  • 1.13 syntax: /gamemode adventure @a – pppery Jul 11 '19 at 21:47

Well, you could always set the command /gamemode 2 @a and then run a clock that activates the command block every few seconds.

Then players don't need to click a button.

  • 2
    That would lag pretty bad... – Timtech Jul 31 '13 at 22:15
  • 1.13 syntax: /gamemode adventure @a – pppery Jul 11 '19 at 21:47

Or you could have them spawn on a pressure plate which sets them to adventure mode, and then once they leave the spawn (with a command block teleporter), it will set them to survival mode. This isn't really used for an adventure server, but it's a good way to make the spawn grief-proof without having to make it out of bedrock.

  • I'm not sure if this was the case before I started playing, but currently the spawn is protected by default in SMP. You have to configure the server to disable this or make someone an op to allow them to break blocks. – Coronus Jul 31 '13 at 20:34

You can enter the command:

/gamemode 2 @[m=0,r=X]

Set X to the radius you want to have people in the adventure mode.

You can also make a second block with the command:

/ gamemode 0 @a[m=2,rm=x+1]

X+1 will switch the players back into the gamemode survival. This would all be connected to a clock or repeating pulser to always check for players. This is a great world guard for servers and adventure maps.

  • 1.13 syntax: /gamemode adventure @a[gamemode=survival,distance=..x], /gamemode survival @a[gamemode=adventure,distance=x+1..] – pppery Jul 11 '19 at 21:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.