⏹️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

type

type: <button 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

slot: <number between 0 and inventory limit>
slot: <page>-<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.

Double chest slots

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.


is-permanent

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.


use-cache

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.


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.

Example:


close-inventory

Allows you to close the inventory after clicking.


refresh-on-click

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.


player-head

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.

You can use mathematical expressions if you set math to true, this allows you to do more complex actions.

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.


update-master-button

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.


update-on-click

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

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.


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.


SWITCH

The SWITCH button allows you to use a placeholder and compare the result with multiple options. This makes it easy to create a quick and simplified display for buttons that require various actions.

You can put several buttons in your switch. And each button can be as complete as possible, you have no limitation !

You must specify the slot for each button. You need to use the refresh inventory action to update your switch button.

Example

In this example, the switch button is used to navigate between pages by using player data.

You can compare numbers by specifying the operator in your switch key. You can use >=, <=, >, and <. For example, you could use: >=10 β€” your placeholder value must then be greater than or equal to 10.


PAGINATION

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

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

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