Inventory views were added in v1.7.0 of ScrollingMenuSign. They use a virtual inventory window to show the menu items as icons, where each icon has a configurable material and a tooltip for the corresponding menu item's label. Inventory views can be popped up with a command, or more conveniently with a "popup book", a written book item with specific text (obtainable with a command or by hitting an existing sign view for the menu you want to add it to). See Creating an Inventory View below for more details.
Credit for the concept goes to @nisovin: http://forums.bukkit.org/threads/icon-menu.108342/
To do anything with inventory views, you must have the scrollingmenusign.use.inventory permission node in addition to any other nodes needed for menu/view manipulation. E.g. to add (
/sms sync) a sign to an existing menu, you'll need scrollingmenusign.use.inventory and scrollingmenusign.commands.sync. By default, non-op players don't have scrollingmenusign.use.inventory - you can give this to players directly, or give them scrollingmenusign.admin or scrollingmenusign.poweruser. See Permissions for more information.
Creating an Inventory View
There are two ways to create an inventory view (you will need the scrollingmenusign.commands.sync permission node for both methods):
To create an inventory view on an existing menu (see here for how to create a menu):
/sms give popup <menu-name> <material>
/sms give popup mymenu blazerod will give you a blaze rod item which is bound to a popup view on the menu mymenu. When that blazerod is clicked, the popup will appear.
(Note that in versions of SMS before v3.0.0, general popup items were not supported; in that case, the only option is
/sms give book <menu-name> to get a written book bound to the menu).
Since there's more than one type of popup view (inventory view, private hologram view, spout view), you can also pass a view name to
/sms give instead of a menu name. In that case, that exact view will be bound to the item (if a menu name is passed, the first popup view that is found will be used).
If the given menu already has an usable popup view, the item will be connected to that view; otherwise, a new view will be created. If you want to force the creation of a new view (perhaps you want two different inventory views with different access control), you can do:
/sms sync <menu-name> -inv # note the view name reported /sms give book <view-name>
You will now have a written book item, which if left or right-clicked, will pop up the inventory view for your menu.
Note that you can also do
POPUP <view-name> in a menu command to display the inventory view, same as for Spout views. This might be useful if you want to pop up an inventory view from some other menu. See Submenus.
Craft (or otherwise obtain) a book and quill item, and hit an existing sign (or multisign) view of the menu you want to add the inventory view to. The book and quill will immediately convert to a written book which is associated with an inventory view on that menu. If the menu already had an inventory view, that will be used. Otherwise, a new inventory view will be automatically created.
Configuring an Inventory View
If you're adding an inventory view on an existing menu, you'll notice that all of the menu items have a stone block for their icon in the virtual inventory that pops up - not very interesting. However, you can set an different icon for each menu item with any valid Minecraft material name. For example:
# Adding a new item with an icon /sms add mymenu Morning "/time day" -icon wool:yellow # Replacing an existing menu item to add an icon /sms edit mymenu Night -icon wool:black
You can change the default icon for menu items which don't specify an icon with the 'inv_view.default_icon' configuration item.
You can also specify that an icon has an amount and (if ProtocolLib is installed), that it should glow. For example:
/sms edit mymenu Test -icon watch,3,glow
will define an icon that is an item stack of three glowing watches.
All inventory windows are 9 slots wide and a maximum of 6 slots high (the number of rows is automatically calculated based on the number of items in the menu). By default, the menu icons span all 9 columns of the inventory. However, it's possible to specify alternative icon layouts by changing the width and item_justify view attributes. For example:
# a 3-column centered layout /sms view <view-name> width 3 /sms view <view-name> item_justify center # or a 6-column left-justified layout /sms view <view-name> width 6 /sms view <view-name> item_justify left
Using an Inventory View
Using an inventory view is very simple; just click the icon for the menu item you want to execute. Mousing over any icon will give you a tooltip showing the menu item's label.
The inventory window will automatically pop down by default, but you can disable this with:
/sms view <view-name> autopopdown false
Pressing Escape will also pop down an active inventory view if you want to close the window without selecting an item.
Removing an Inventory View
To remove any inventory view:
/sms break <view-name>
(This works for any view type).
See Usage/Managing Views for information on viewing and changing view attributes.
Inventory views support the following attributes:
|access||Access control for the view; one of ANY, OWNER, OWNER_GROUP or GROUP||ANY|
|autopopdown||If true, then the inventory window will close as soon as an icon is clicked. Otherwise the inventory window will stay open until Escape is pressed||true|
|item_justify||May be one of default, left, center or right. Specifies how to lay out the icons in each row. If default, then the global 'item_justify' configuration setting will be used.||default|
|noescape||If true, the inventory view window cannot be dismissed by pressing Escape (or 'E') - only by selecting an item. If this is set to true, then the autopopdown attribute must also be set to true!||false|
|owner||The name of the owning player.||Player who created the view|
|spacing||The number of blank inventory slots to put between each icon||0|
|width||The number of icons to display per inventory window row. (Note that inventory windows are always 9 slots wide)||9|