Skip to content
Update Generated menus authored by Nanit's avatar Nanit
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* [Players](#catalog-players) * [Players](#catalog-players)
* [Worlds](#catalog-worlds) * [Worlds](#catalog-worlds)
* [Entities](#catalog-entities) * [Entities](#catalog-entities)
* [BungeeCord Servers](#catalog-servers) * [BungeeCord servers](#catalog-servers)
* [Iterator](#catalog-iterator) * [Iterator](#catalog-iterator)
## <a name="general"> Auto Generation Basics </a> ## <a name="general"> Auto Generation Basics </a>
...@@ -15,24 +15,24 @@ Since version 1.8 the plugin supports auto-generation of menus. ...@@ -15,24 +15,24 @@ Since version 1.8 the plugin supports auto-generation of menus.
The menu is generated like this: The menu is generated like this:
1) The catalog of objects is taken. It can contain additional parameters for filtering objects, etc. 1) You specify the catalog of objects. It can contain additional parameters for filtering objects, etc.
2) A matrix of cells is set, into which items from the catalog will be placed according to the template. The matrix should have as many rows as the menu itself. 2) You create a matrix of cells, into which items from the catalog will be placed according to the template. The matrix should have as many rows as the menu itself.
3) One or more item templates are set. It is in these items that the necessary placeholders from the catalog are indicated. 3) You specify item templates. It is in these items that the necessary placeholders from the catalog are indicated.
4) The constructed menu can have several pages. Special actions are used to navigate the pages. 4) The generated menu might have several pages. Special actions are used to navigate the pages.
The catalogs are listed below. Here we will show you how to create a simple generated menu. We will use the PLAYERS directory, which generates a list of all the players that are on the server. The catalogs are listed below. Here we will show you how to create a simple generated menu. We will use the `PLAYERS` catalog, which generates a list of all the players that are on the server.
```hocon ```hocon
title: "Generated Menu" title: "Generated Menu"
size: 4 size: 4
# Object catalog data to generate # Catalog of objects data to generate
catalog { catalog {
# Name of the registered directory # Name of the registered catalog
type: PLAYERS type: PLAYERS
} }
# A matrix of cells that will be used to generate # A matrix of cells that will be used to generating
matrix { matrix {
# Templates for matrix # Templates for matrix
templates { templates {
...@@ -51,9 +51,9 @@ matrix { ...@@ -51,9 +51,9 @@ matrix {
} }
``` ```
Here we have created a menu with 4 lines. Once we have specified the `catalog` parameter, the plugin will assume that our menu is auto-generated and will behave accordingly. Here we have created a menu with 4 lines. Once we have specified the `catalog` parameter, the plugin will assume that our menu is auto-generated and will behave appropriately.
`templates` - This is a list of menu templates. There can be many such templates. Each matrix template must have its own tag. A tag is any Latin character from `a` to `z`, or a special character. After we have created the tag, inside it we can describe any menu item, as if we were doing it in the `items` block for the menu buttons. Note that we are not specifying a slot. This is because the slot is automatically detected when the menu is generated. `templates` - This is a list of menu templates. There can be many such templates. Each matrix template must have its own tag. A tag is any Latin character from `a` to `z`, or a special character. After we have created the tag, we can describe any menu item inside, as if we were doing it in the `items` block for the menu buttons. Note that we are not specifying a slot. This is because the slot is automatically detected when the menu is generated.
`cells` - This is a matrix of cells. It is essentially a list of strings. Each row of the matrix is ​​a menu row. Each symbol represents an inventory slot. The `_` character (or any other character that is not in the `templates` templates) denotes an empty slot, that is, no item will be added to that inventory slot. The `x` character is the template tag that we defined earlier. This means that only the item of the template `x` and no other item can be added to this inventory slot. `cells` - This is a matrix of cells. It is essentially a list of strings. Each row of the matrix is ​​a menu row. Each symbol represents an inventory slot. The `_` character (or any other character that is not in the `templates` templates) denotes an empty slot, that is, no item will be added to that inventory slot. The `x` character is the template tag that we defined earlier. This means that only the item of the template `x` and no other item can be added to this inventory slot.
...@@ -63,7 +63,7 @@ As a result, with enough online, we will get such a menu. ...@@ -63,7 +63,7 @@ As a result, with enough online, we will get such a menu.
## <a name="pages"> Switching pages </a> ## <a name="pages"> Switching pages </a>
Since there may be many objects in the provided directory, the menu is paginated when generated. To scroll through these pages, two new actions were created for the buttons: `pageNext` and `pagePrev`, which scroll the next and previous page respectively. Since there may be many objects in the provided catalog, the menu is paginated when generated. To scroll through these pages, we have created two new actions for the buttons: `pageNext` and `pagePrev`, which scroll the next and previous page respectively.
To add buttons for scrolling, you need to define a list of static buttons, as we do on a regular menu. To add buttons for scrolling, you need to define a list of static buttons, as we do on a regular menu.
... ...
......