3

How can I use a command block to turn everyone (except myself) into adventure mode (gamemode 2)? Any command which does this would be awesome.

6
  • Have you done any research yourself? Apr 25 '16 at 0:39
  • what do you mean
    – Mr.Luca
    Apr 25 '16 at 0:44
  • Have you tried any commands yourself? Apr 25 '16 at 0:44
  • no i couldnt find any like except player name command
    – Mr.Luca
    Apr 25 '16 at 0:45
  • Is there a way to use radius more than? Apr 27 '16 at 8:46
8

Try using

/gamemode adventure @a[name=!<player>]

What this exactly does is: /gamemode adventure - Sets gamemode to adventure.

@a[name=!<player>] - Targets all players, except the name of the player specified there. The ! means "except".

If your Minecraft name for example was MrLuca, then the command would be:

/gamemode adventure @a[name=!MrLuca]
3
  • +1 This answer is better than mine, to be honest. My answer doesn't work with command blocks, and has some possible pitfalls.
    – APCoding
    Apr 25 '16 at 17:49
  • 1
    Do be aware that Minecraft development is trying to move away from numerical IDs. It would be preferable to use "adventure" instead of "2" (and the same would go for the m selector parameter, which has been updated in 1.9 to accept the name ID; @a[m=adventure]).
    – Skylinerw
    Apr 26 '16 at 2:37
  • 1
    1.13 syntax: /gamemode adventure @a[name=!<player>]; The "move away from numerical IDs" finally finished in 1.13
    – pppery
    Jul 14 '19 at 22:25
4
/gamemode adventure @a[rm=1]

Should do the trick. The rm tag means everyone outside of the given radius. Since you will most probably be the only one that close to yourself, this should work. If not, just move to a different place.

4
  • 1
    The syntax is incorrect, the player argument comes after the gamemode.
    – Skylinerw
    Apr 25 '16 at 3:21
  • 2
    @Skylinerw Didn't realize that! Sorry! Fixed it know. Thanks for pointing it out.
    – APCoding
    Apr 25 '16 at 3:24
  • This would be good if you run /execute on yourself (so you are the center of execution, not the commandblock), but otherwise it is not usable a lot. Apr 25 '16 at 10:53
  • 1.13 syntax: /gamemode adventure @a[distance=1..]
    – pppery
    Jul 14 '19 at 22:26
1

Try this: /gamemode a @a[name=!Your_name_here]

1
  • Can you add more to your answer like your source and how this works.
    – Jason_
    Apr 25 '16 at 3:21

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