How do you prevent admins/ops on vanilla minecraft server to change gamemodes?

How do you prevent admins/ops on vanilla minecraft server to change gamemodes? - Top view of retro light box with THANK YOU DOCTORS inscription placed on green surface

Me and my friends have a private Minecraft server but sometimes 2 of my friends change gamemode to creative or spectator and I don't want that. Does anyone have idea how to prevent that from happening? I can't de-op them because we use /tp command.



Best Answer

You can use a command block on a clock to constantly change the gamemode of players not in survival back into survival mode. Example using 1.9, where the m selector parameter accepts string values (and thus the NOT operator):

/gamemode survival @a[m=!survival]

However, keep in mind that this also changes players from adventure mode into survival. If you wanted adventure mode to remain unchanged, you'd need two command blocks to change players out of either creative or spectator mode specifically:

/gamemode survival @a[m=creative]
/gamemode survival @a[m=spectator]

For pre-1.9, you'd have to use the second method and numerical IDs, as string values and the NOT operator are not available:

/gamemode survival @a[m=1]
/gamemode survival @a[m=3]



Pictures about "How do you prevent admins/ops on vanilla minecraft server to change gamemodes?"

How do you prevent admins/ops on vanilla minecraft server to change gamemodes? - From above of vintage light box with THANK YOU DOCTORS inscription placed on green surface
How do you prevent admins/ops on vanilla minecraft server to change gamemodes? - From above of vintage light box with THANK YOU DOCTORS gratitude message placed on green surface
How do you prevent admins/ops on vanilla minecraft server to change gamemodes? - Top view of red heart shaped decorative elements and white retro light box with THANK YOU DOCTORS gratitude message arranged on green background



How do you give permission to change gamemode in Minecraft?

type /gamerule logAdminCommands false, this should do the trick so when you type commands in it shouldn't display it to the player in question.

How do you change your gamemode without anyone knowing?

Go to the \u201cserver. properties\u201d file in your server's config files. Change the line that says \u201cenable-command-block=false\u201d to \u201cenable-command-block=true\u201d Give yourself a Command Block by opening the chat box and entering \u201c/give [your username] minecraft:command_block\u201d

How do you block commands on a Minecraft server?

Only operators can see command output from players. If you demote them to a regular player, they will not see it in the chat. And now, if you run your command through the command block, no one will be able to see the output in chat.



Minecraft HACK: How to Prevent Creative Mode in Realms as Owner/Administrator 1.14/1.15




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Karolina Grabowska, Karolina Grabowska, Karolina Grabowska, Karolina Grabowska