Difference between revisions of "Commands"
(Fixed formatting.) |
|||
Line 4: | Line 4: | ||
The '''seed''' command is a vanilla command, meaning it comes with Minecraft without any modifications. | The '''seed''' command is a vanilla command, meaning it comes with Minecraft without any modifications. | ||
− | + | ==Permissions== | |
Some commands require '''permissions'''. If a player does not have the appropriate permissions for a command an error message is sent to the player. Vanilla commands that require permissions are acquired by becoming an [http://minecraft.gamepedia.com/Operator Operator]. | Some commands require '''permissions'''. If a player does not have the appropriate permissions for a command an error message is sent to the player. Vanilla commands that require permissions are acquired by becoming an [http://minecraft.gamepedia.com/Operator Operator]. | ||
Line 15: | Line 15: | ||
{{example|text="'''my.command.permission'''"}} | {{example|text="'''my.command.permission'''"}} | ||
− | + | ==Arguments== | |
There are commands such as /seed which are simple that tell you the seed of the current world you're in, but commands do much more than that. As a developer, you can implement '''commands with arguments''' to allow your users to insert their own values and the rest is done behind the scenes (in the code). | There are commands such as /seed which are simple that tell you the seed of the current world you're in, but commands do much more than that. As a developer, you can implement '''commands with arguments''' to allow your users to insert their own values and the rest is done behind the scenes (in the code). | ||
Revision as of 07:02, 18 January 2014
A command in Minecraft starts with a forward slash (/).
The seed command is a vanilla command, meaning it comes with Minecraft without any modifications.
Permissions
Some commands require permissions. If a player does not have the appropriate permissions for a command an error message is sent to the player. Vanilla commands that require permissions are acquired by becoming an Operator.
Though Minecraft server modifications such as Bukkit have a permissions implementation that allow you to apply permission nodes (String) to players, this allows for maximum flexibility.
A permission node is a String (text) usually seperated with fullstops/periods (.) instead of whitespaces.
Arguments
There are commands such as /seed which are simple that tell you the seed of the current world you're in, but commands do much more than that. As a developer, you can implement commands with arguments to allow your users to insert their own values and the rest is done behind the scenes (in the code).
/tp [target player] <x> <y> <z>
The example above is copied straight out of the vanilla Minecraft which allows you to teleport around the world. Now, you might get confused since you see square brackets ([]) and angle brackets (<>), those are the arguments. Any developer can implement their syntax just the way they want so don't base the following information on all plugins, though I (SupaHam) tend to make mine similar to how Minecraft and many Bukkit plugins do theirs. So with the tp command the square brackets are optional and the angle brackets are required. Usually between these brackets are a descriptive one/two words.
So, the tp command has the [target player] and the <destination player> argument for one of the usages. If you understood well then you should know that the [target player] is not required but the <destination player> is.
Minecraft then takes that 'Steve' argument and checks if it's valid
Case: Steve is online
- Minecraft checks if Steve is online on the same server as SupaHam. If Steve is online, SupaHam will get teleported to him.
Case: Steve is offline
- Minecraft outputs an error to the command sender saying 'Steve' is not a valid player.
B. SupaHam executes /tp Steve SupaHam
Notice the difference between command A and command B? Command B is making use of the optional argument ([target player]).
Minecraft then takes both 'Steve' and 'SupaHam' and check if they are both valid players, as shown with the cases above. If they are both valid Minecraft then teleports 'Steve' to 'SupaHam'.