âšī¸Buttons
All information about the buttons
Informations
Buttons allow you to customize the actions in your inventory. You need to specify the type of each button and configure the elements specific to that button type. Below, you'll find the buttons that are integrated by default in the plugin; other plugins can also add new types of buttons.
For each button, you must specify an Item
. To learn how to configure an Item
, go here.
Configuration
Here are the configuration elements that are common to all types of buttons. You can use these elements universally across different button types.
TYPE
The type of the button. By default, the type will be set to NONE
. It is important to set the button type if you want to perform specific actions.
SLOT
Specify the slot where your item will be displayed.
Slots start at 0.
You can specify the page number directly in the slot. The format should be:
<page>-<slot>
. For example, for a button on page 2 and slot 8, you would use:2-8
.To place multiple items in the same slot, you must use the
else
button.
To display a button on multiple slots, you can do it like this:
You can also create slot ranges using this format: <startslot>-<endslot>
.
Page
Allows you to specify the page where the button will be displayed. By default, the page will be set to 1.
IsPermanent
Allows you to specify if the button should be displayed on all pages of the inventory. If your inventory has only one page, you donât need to use this option.
useCache
Allows you to enable or disable caching on the item. By default, caching will always be used if the button item does not contain a placeholder.
Item
Allows you to specify the item that will be displayed. For more information, click here.
Sound
Allows you to play a sound for the player when they click. You must use the sounds available in XSound. You can also adjust the pitch and volume of the sound.
Messages
Allows you to send a list of messages to the player upon clicking. You can use the MiniMessage format to send messages with click or hover actions.
Openlink
Allows you to send a clickable message to the player. You need to include in your message list a text that will be replaced by the clickable link. An example is provided below.
Please use this only if your server is running an older version of Minecraft. Otherwise, use the MiniMessage format, which is much easier to work with.
Example:
CloseInventory
Allows you to close the inventory after clicking.
RefreshOnClick
Allows the button to refresh after a click. You can use this feature to create a shop, for example. An example is provided in the default configuration.
PlayerHead
Allows you to display a player's head based on a placeholder. You can use the placeholder %player%
to display the head of the player who opens the inventory.
A caching system ensures the direct display of the skin for the heads.
Permission
Allows you to define a permission that the player must have to display the item. You can reverse the permission by adding !
in front of the permission, which will cause the plugin to check that the player does not have the permission.
You can also define a list of permissions the player must have:
Or Permission
Allows you to define a list of permissions, where the player only needs to have one of them.
Else
Allows you to display an else
button if the player doesn't have the required permission. You can place multiple else
buttons in a row without any issues. An example of this usage can be found in the default configuration.
Example:
Placeholder
Allows you to define a permission using a placeholder. You must specify the placeholder, the action to be performed with the value, and the value that will be checked.
Actions:
BOOLEAN
(alias:b=
): Checks if a value is true or false.EQUALS_STRING
(alias:s=
): Checks if the text is strictly equal to the value.EQUALSIGNORECASE_STRING
(alias:s==
): Checks if the text is equal to the value, ignoring case.CONTAINS_STRING
(alias:sc
): Checks if the text is contained within the value.DIFFERENT_STRING
(alias:s!=
): Checks if the text is different from the value.SUPERIOR
(alias:>
): Checks if a number is strictly greater than the value.LOWER
(alias:<
): Checks if a number is strictly less than the value.SUPERIOR_OR_EQUAL
(alias:>=
): Checks if a number is greater than or equal to the value.LOWER_OR_EQUAL
(alias:<=
): Checks if a number is less than or equal to the value.EQUAL_TO
(alias:==
): Verifies that two numbers are identical.
You can check multiple placeholders like this:
Update
Enables the automatic update of the item's name and lore. To configure the update interval, please refer to this section.
UpdateMasterButton
Allows you to completely update the button. You need to enable the update option for this feature to be activated. Instead of just updating the name and lore, this option refreshes the entire button. This includes rechecking permissions, requirements, and the else
button.
UpdateOnClick
Allows your button to be updated whenever a player clicks anywhere in the inventory, regardless of the slot.
Commands
Allows the player to execute a list of commands. You can use the placeholder %player%
to retrieve the username of the player executing the commands.
Console Commands
You can execute commands from the console based on the player's click, as well as commands that require specific player permissions. You can use the placeholder %player%
to retrieve the username of the player executing the commands.
View Requirement
Sets the conditions the player must meet to see the button. This can include permissions, placeholders, and other criteria. For more information, refer to this section.
Click Requirement
Defines the conditions the player must meet to click on the button. These requirements are checked when the player clicks, and actions can be executed based on the success or failure of these conditions. For more information, refer to this section.
Actions
You can define a list of actions to perform when clicking. These actions can include sending messages, executing commands, opening a book, and more. For more information, refer to this section.
Error item (zMenu+)
Example of Inventory with Fail Item:
In this example, if the player is not in creative mode, a barrier with the name "Error" will be displayed for 10 ticks.
NONE
The NONE
type is the default type; it simply displays a button. You don't need to specify it, as it will be automatically selected if the plugin doesn't detect a different type.
INVENTORY
The INVENTORY
type allows the player to open a new inventory.
inventory
: The name of the inventory you want to open. This should match the name of the inventory file.plugin
: The name of the plugin from which the inventory originates. It's advisable to specify the plugin name to avoid opening a different inventory with the same name.toPage
: The page number you want to open. The default is page 1.arguments
: A list of arguments you can add. Each argument can include a name in the following format:<name>:<value>
.
You must specify the inventory's name, which corresponds to the file name where the inventory is stored. Additionally, it's recommended to specify the plugin name to avoid confusion if two inventories share the same name.
BACK
The BACK
type allows you to return to the previous inventory.
HOME
The HOME
type allows you to return to the main inventory, which is the first one that was opened.
NEXT
The NEXT
type allows you to go to the next page, if it exists. You can use the else
element to display another button if there is no next page.
Example:
PREVIOUS
The PREVIOUS
type allows you to go to the previous page, if it exists. You can use the else
element to display another button if there is no previous page.
MAINMENU
The MAINMENU
type allows you to return to the main inventory specified in the config.json
.
JUMP
The JUMP
type allows you to change to a predefined page.
PAGINATION (zMenu+)
Example of Inventory with Pagination Button:
In this example, the items will be displayed in slots 21, 22, and 23 across multiple pages.
The list of items includes the material and the name. You can put anything you want in the list. To use the values, you must reference them with the placeholder keys. In this example, the keys will be %material%
and %name%
.
You can also modify the values like this:
%lower_<key>%
- Displays the value in lowercase.%upper_<key>%
- Displays the value in uppercase.%capitalize_<key>%
- Displays the value with the first letter capitalized.
You can use placeholders everywhere, including in your requirements, commands, and other placeholders.
DYNAMIC PAGINATION (zMenu+)
This feature allows you to create a dynamic inventory using placeholders, offering limitless possibilities such as creating a ranking system. The only limit is your imagination.
In the example below, placeholders are generated by zMenu+ as an example:
%zmenu+_pagination_size%
- Returns the size of your list. This value will change when the plugin is loaded.%zmenu+_pagination_name_<index>%
- Returns text based on the index. The text is generated automatically when the plugin is loaded.
You must specify the start and end of the pagination using start
and end
, which work with PlaceholderAPI.
Additionally, you have three internal placeholders to help you identify the button number that is displayed:
%index%
- Returns the index of the button, starting at 0.%current%
- Returns the index of the button plus 1, starting at 1.%value%
- Returns the value of the button.
If your pagination does not start with 0, you must use this placeholder to retrieve the correct index of the button.
INPUT (zMenu+)
This feature allows the player to input a message in the chat and triggers actions based on success or error.
Input Types:
NUMBER - Checks a number; you can set a minimum and maximum value.
TEXT - Checks a text input; you can set a regex pattern for validation.
ONLINE_PLAYER - Checks if the input matches the nickname of an online player.
You can add conditions based on the input type:
For NUMBER, you can specify a minimum and maximum value.
For TEXT, you can use a regex pattern for validation.
Example: In this example, the button checks if the chosen number is between 0 and 100.
Last updated