When a player joins the server, this command block (containing gamemode 2 @a) puts them into gamemode 2/adventure mode. How can I change this so that only non-admin/not "opped" players' gamemode gets changed?

enter image description here

  • 2
    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 Nov 22 '17 at 2:22
  • Yes I have tryed – JustANormalGuy Nov 22 '17 at 3:04
  • 2
    Awesome! So show us what you've tried, so we have an idea of what we're working with. – Frank Nov 22 '17 at 3:07
  • Give more details as well. Is the server not adventure mode? Is this designed to lock the new players in somewhere? Why not use spawn protection to prevent blocks from being broken? How many op players do you have? – IronAnvil Nov 22 '17 at 3:19
  • Just set the default gamemode to adventure..? – dly Nov 22 '17 at 8:04

I don't think there's an automatic way to differentiate admins. But since the number of admins should be low, you can just tag them all manually using:

/tag <name> add admin

Then you replace the command in your command block with:

/gamemode adventure @a[tag=!admin]

Also, an improvement: If you click the button in the command block GUI saying Impulse twice, it changes to Repeat and the command block turns blue. Then click on Needs redstone to change it to Always active and you can just remove the redstone clock next to it. The command block will continue to run, take immediate effect and produce less lag.

And lastly, you can improve performance further by restricting the number of affected players to only the ones that are in the default gamemode of the server. If that's for example Survival mode, you can use:

/gamemode adventure @a[tag=!admin,gamemode=survival]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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