Item actions
This page describes how to configure item actions.
What is an action?
In CraftVentory, an item action is a behavior executed when a player clicks on an item. An item may have as many actions as you want.
Item actions are fully configurable and each action has its own set of customizable properties. In an item configuration, actions are declared as a list in the actions property.
close:
# Item configuration section.
# See the 'Item configuration' chapter of this tutorial.
item:
type: BARRIER
# Symbol of the item to place it in the inventory.
symbol: "C"
# Set of actions executed when a player clicks on the item.
actions:
# Action name.
- action: "CLOSE"
# Additionnal properties may be listed below depending on the action.Available actions
In the list below, you can find all the actions provided by default by the library.
Close
Close the opened inventory.
Message
Send a message to the inventory viewer.
Broadcast
Broadcast a message in the chat.
Player command
Make the inventory viewer execute a list of commands.
Console command
When performed, this action makes the server execute a command.
Sound
Play a sound to the inventory viewer.
Update content
Trigger an update of the content of an opened inventory.
Update paginations
Trigger an update of the paginations in an opened inventory.
Open inventory
Open a new inventory.
Home
Open the root inventory in the viewer's history.
Backward
Open a previously opened inventory in the history which is before the current one in the history.
Forward
Open a previously opened inventory in the history which is after the current one in the history.
Click type
CraftVentory enables to configure the type of click a user must do to execute an action by adding the click-types property.
Example:
Last updated