In Minecraft, I am making a map in which there may be hardish parts. Currently, they're allowed to cheat using /gamemode, but I want to make it so that they can't. They also get an achievement for trying to cheat.

Basically, I am asking for a series of 3 commands I can run in an infinite loop, which runs 3 command blocks, that will, in order:

  1. Check for if the player/one of the players is cheating.
  2. Tell them they've been cheating and give them an achievement.
  3. Change their gamemode back to Adventure mode.
  • 1
    Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
    – Frank
    Oct 6, 2017 at 21:29
  • 1
    I've tried looking all over for an answer, but no-one has it already asked and answered. That's why I came here. Oct 6, 2017 at 21:33
  • 1
    @a[m=!adventure] will select all players that are not in adventure mode. The advancement command can grant advancements, and the gamemode command can change gamemodes. That really should be all you need, and it's all listed on the wiki.
    – AjaxGb
    Oct 6, 2017 at 21:37
  • 1
    That's unfortunate. Try using commands to delete the command block. In future, you can add an exception (@a[m=!adventure,tag=!admin]) for people with a special tag, then give yourself that tag.
    – AjaxGb
    Oct 6, 2017 at 21:52
  • 2
    Be patient. People will answer when they do. We are volunteers, so there is no time limit as to when someone can or will answer.
    – Frank
    Oct 7, 2017 at 2:42

1 Answer 1


You can use the selector @a[gamemode=creative] to detect all players in creative mode.

But if you allow players access to commands, you can't guarantee for anything. They could just use /setblock to replace the command block detecting their gamemode change or do something else against it. There are ways to prevent that, but you're very quickly getting into an endless game of cat and mouse to prevent every possible way they could tamper with your system. That can be fun (I'm planning to do such a thing in the future), but it's certainly not what you want in this case. Better just disallow commands for everyone.

  • 1
    1.13 syntax: @a[gamemode=creative]
    – pppery
    Aug 20, 2018 at 22:10
  • That's right, it changed in 1.13, thanks for telling me. Updating my answers to 1.13 is still on my todo list, but only for answers with score of 2 or more, since otherwise I would have to check 239 answers. Aug 21, 2018 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .