usage/Adding Menu Items
To add a menu item to an existing menu, type
/sms add <name> <label> <command> [<options...>]. If any argument contains whitespace, quote it with double quotes (").
The accepted options are:
- -at <index>: Add the new item at the given (1-based) index instead of at the end of the list
- -altcommand <command>: The alternative command to use (accessing this alternative command depends on the view type and the configured action bindings; by default shift-left-click is used).
- -feedback <message>: Define a message which will be sent to the player when they execute this item
- -icon <material>: Define an icon for the item (currently only used by inventory views)
- -lore <text>: Define some lore (tooltip) text for the item
- -perm <permission-node>: The player must have the given permission node to use (and depending on the view type, even see) this menu item.
The icon material can be any valid Bukkit or WorldEdit material name or numeric material ID, and can include a data value. E.g. "stone", "wool:black", "20" (meaning glass; but it is recommended to use "glass" instead).
/sms add mymenu Day "/time day" -feedback "It's daytime!" -icon wool:white /sms add mymenu Night "/time night" -feedback "It's night time!" -icon wool:black
adds a menu entry to the menu called
mymenu with a label of "Day", and one with a label of "Night". If "Day" is executed (left-clicked), it will issue /time day as a command, and send a message to the player of "It's daytime!". Similarly for "Night".
You can leave out the message if you want, e.g.:
/sms add mymenu Compass /compass
You can even leave out the command, which might be useful if you just want some feedback text to be shown to the player:
/sms add mymenu "Help" -feedback "This is some help text!"
(This is particularly useful with macros; macros can be used for feedback text as well as commands, so you can use them to display large blocks of help text)
If the command doesn't start with a slash (/), then the player will speak the command string instead, e.g.:
/sms add mymenu "Say hello" "Hello everyone!"
Coloured Items and Markup
Menu labels and feedback text can be coloured, just like sign titles. The same syntax applies. Example:
/sms add mymenu &1Compass /compass
gives this entry a blue label.
Arbitrary Unicode characters can also be used, via HTML escape codes. For example:
/sms add mymenu &1ΑΒΓ虘" /somecommand
See http://www.escapecodes.info/ for a list of some of the useful characters you might want to use.
Adding Items at a Specific Position
By default, menu items are appended to the end of the menu. If you want to add an item at an arbitrary position in the menu, you can specify the position with the "-at" option, like this:
/sms add mymenu -at 1 "Hello" "Hello everyone!"
That adds the entry at position 1, i.e. the start of the menu.
- CommandParser for more information on how commands are parsed and executed, and some more advanced usage (permission elevation, command costs, economy support...)
- Usage / Editing Menu Items and Usage / Removing Menu Items for other item manipulation commands
Note: The old-style syntax of adding items like this:
/sms add mymenu label|command|message no longer works as of v1.4.0.