You can use them as you would use a regular command in chat.
Example:
This gives [user] two of item id 1 when the command block is activated with redstone.
/gamemode [user] [0, 1, 2]
This will change [user]'s gamemode to either 0 (Survival) 1 (Creative) or 2 (Adventure)
Note and Edit: Buttons S (Survival) C (Creative) and A (Adventure) work as well as SevenSidedDie has noted for /gamemode
The syntax for the sudo command is /<command> <player> <command [args]>
and its description is Make another user perform a command. With the command /sudo @a gc
you force every player to execute /gc
. Means everyone see the server usage information.
If you typed /sudo @a save-all
in the commandblock, be happy that it dosen't work because that could be ending in a server crash. (Everybody on the server is forced to execute the command /save-all
, what needs much hardware usage)
What I think that you missleading it with the sudo command from linux where the command is executed as root.
The problem why you can not execute the command /save-all
in a commandblock is because it is disabled from the server itself for security reasons.
In the Minecraft Wiki you find that information:
These commands are likely disabled due to limited use in command
blocks and the potential for severe, unintended consequences on
servers.
That counts for the commands:
ban, ban-ip, deop, kick, op, pardon, pardon-ip, save-all, save-off,
save-on, stop, whitelist add/remove/on/off/reload, debug, publish
If you really need that command, the only possibility is to use a command of a other plugin and not the original command /save-all
.
But make sure that it is executed only once! Keep in mind that griefer could use it to crash the server by expensive hardware usage if they spam the button!
Best Answer
This actually depends on what version you're using. Since there's no right-click function in the command block menu, you have to use keyboard shortcuts; however, different versions use different shortcuts. Minecraft 1.7.10 and earlier were all made using the shortcuts for Windows and other systems, so if you're using one of those older versions you have to use Ctrl+V to paste. This gets confusing, because other applications still use ⌘ on Mac. However, if you're using any version of 1.8 or later, you can use ⌘ + V, like the other applications on Mac do.
TL;DR ⌘ + V if you're using 1.8 or higher, Ctrl+V if you're on 1.7.10 or lower