You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> However, if you use the `PlayerInventory#setHelmet` function (or another method to define an armor piece),
166
+
> `HoldHandler` will NOT detect it automatically.\
167
+
> You must call the `HashGuiHold#refreshArmorState(Player player)` function to refresh the detection.
168
+
169
+
### 🫱 Hit handler
170
+
171
+
You can define the action executed when a player hits another player with an item.
172
+
173
+
#### Features :
174
+
175
+
- Death only (executes the action only if the hit results in a death)
176
+
```java
177
+
HitHandler#setOnlyKill(true);
178
+
```
179
+
180
+
### 🫱 Destroy handler
181
+
182
+
You can define the action executed when a player breaks a block with an item.
183
+
184
+
123
185
### HashGuiManager
124
186
125
-
In order to make click & interaction handlers working, you need to create an instance of `HashGuiManager` at the root
187
+
In order to make handlers working, you need to create an instance of `HashGuiManager` at the root
126
188
of your plugin and give this instance to your custom item build.
127
189
128
190
**Example:**
@@ -279,4 +341,79 @@ If a letter has no assigned item, this one will be used:
279
341
> [!CAUTION]
280
342
> Space character (``) can't be used, as it serves as void.
281
343
282
-
## Made with 💜 by [Lysandre B.](https://github.com/Shuvlyy) ・ [](https://wakatime.com/badge/user/2f50fe6c-0368-4bef-aa01-3a67193b63f8/project/018d7a18-67ef-47e3-a6c4-5c8cc4b45021) + [](https://wakatime.com/badge/user/2f50fe6c-0368-4bef-aa01-3a67193b63f8/project/018d794b-8bf6-46ef-acb3-549287335474)
344
+
## PaginatedHashGui
345
+
346
+
`PaginatedHashGui` is a `HashGui` with a pagination system.
347
+
348
+
### Usage
349
+
350
+
```java
351
+
String title ="Paginated menu";
352
+
int linesAmount =6;
353
+
354
+
PaginatedHashGui gui =newPaginatedHashGui(title, linesAmount, guiManager); // guiManager must be an instance of HashGuiManager.
gui.setPreviousPageItem(previousPage); // When clicking on previousPage, the GUI will refresh to the previous page.
363
+
gui.setNextPageItem(nextPage); // When clicking on previousPage, the GUI will refresh to the next page.
364
+
```
365
+
366
+
#### Features
367
+
368
+
*`setPreviousPageItem(HashItem item)` : Refreshes the GUI to the previous page (if possible)
369
+
*`setNextPageItem(HashItem item)` : Refreshes the GUI to the next page (if possible)
370
+
*`update(Player player)` : Refreshes the GUI (for the pages)
371
+
*`clearPageContent()` : Visually clears current page (used for refreshing)
372
+
*`addPage(Page page)` : Adds a new page
373
+
*`createNewPage()` : Creates a fresh new page and adds it
374
+
*`clearPages()` : Deletes all pages
375
+
376
+
### Pages
377
+
378
+
#### Page creation
379
+
380
+
```java
381
+
PaginatedHashGui gui;
382
+
383
+
Page page = gui.createNewPage(); // Creates a new page and adds it to the GUI
384
+
385
+
/* OR */
386
+
387
+
Page page =newPage(gui); // Creates a new page
388
+
gui.addPage(page); // Adds it to the GUI
389
+
```
390
+
391
+
#### Features
392
+
*`addItem(HashItem item)` : Adds an item in the page at the first free slot
393
+
*`setItem(int slot, HashItem item)` : Adds an item in the page at a specific slot
394
+
*`removeItem(int slot)` : Removes the item linked to a slot
395
+
*`clearItems()` : Clears page's items
396
+
397
+
> [!TIP]
398
+
> By default, at the creation of a `PaginatedHashGui`, a fresh new page will be automatically created and added.
399
+
400
+
#### Page management
401
+
402
+
```java
403
+
Page page;
404
+
405
+
HashItem item1 =newHashItem(Material.BED);
406
+
HashItem item2 =newHashItem(Material.BEDROCK);
407
+
408
+
page.addItem(item1);
409
+
page.setItem(8, item2);
410
+
page.removeItem(8);
411
+
```
412
+
413
+
> [!WARNING]
414
+
> * For `Page#addItem()`, if no slots are free, a `IllegalArgumentException` will be thrown.
415
+
> * For `Page#setItem()` or `Page#removeItem()`, if the given slot is not free, the same exception will be thrown.
416
+
> ***A slot is considered not free if it's not valid (below 0 or greater than the maximum capacity of the GUI)
417
+
> or if an item is already present at this slot in the parent GUI.**
418
+
419
+
## Made with 💜 by [Lysandre B.](https://github.com/Shuvlyy) ・ [](https://wakatime.com/badge/user/2f50fe6c-0368-4bef-aa01-3a67193b63f8/project/018d794b-8bf6-46ef-acb3-549287335474) + [](https://wakatime.com/badge/user/2f50fe6c-0368-4bef-aa01-3a67193b63f8/project/018d7a18-67ef-47e3-a6c4-5c8cc4b45021)
0 commit comments