minecraftminecraft-commands

How to check if one person is in gamemode 2 in minecraft 1.13 snapshots


I am coding a minecraft game in command blocks, which involves the last person standing being the winner. I have made it that once a player dies, they change into gamemode 3 automatically. I am using a scoreboard that counts deaths to switch the gamemode.

My question to you is: Is there a way to detect if there is only one person in gamemode 2, and if this is true, make it enable a second command block that finishes the game?


Solution

  • Did you mean adventure (game mode 2) or spectator (game mode 3)? Your question is ambiguous

    @p[m=spectator]
    or
    @p[m=sp]
    or
    @p[m=3]

    I figured this out by looking at this documentation page:

    https://minecraft.gamepedia.com/Commands#Target_selectors