Skip to content

Commit c8ea8e7

Browse files
committed
custom items can be added to paginated menu border
1 parent 54c5366 commit c8ea8e7

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SimpAPI v4.1.9
1+
# SimpAPI v4.2.0
22
****
33
SimpAPI, finally a good API that can make coding MC Plugins much easier and less painful.
44
This API includes all of my primary utilities like *Menu Manager*, *Command Manager*, *ColorTranslator*, and more.
@@ -25,7 +25,7 @@ JavaDocs: https://kodysimpson.github.io/SimpAPI/index.html
2525
<dependency>
2626
<groupId>com.github.KodySimpson</groupId>
2727
<artifactId>SimpAPI</artifactId>
28-
<version>4.1.9</version>
28+
<version>4.2.0</version>
2929
</dependency>
3030
```
3131

@@ -51,7 +51,7 @@ repositories {
5151
Groovy/Kotlin:
5252
```groovy
5353
dependencies {
54-
implementation 'com.github.KodySimpson:SimpAPI:4.1.9'
54+
implementation 'com.github.KodySimpson:SimpAPI:4.2.0'
5555
}
5656
```
5757

src/main/java/me/kodysimpson/simpapi/menu/PaginatedMenu.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
import org.bukkit.ChatColor;
44
import org.bukkit.Material;
5+
import org.bukkit.inventory.ItemStack;
6+
import org.jetbrains.annotations.Nullable;
57

8+
import java.util.HashMap;
69
import java.util.List;
710

811
public abstract class PaginatedMenu extends Menu {
@@ -34,15 +37,19 @@ public PaginatedMenu(PlayerMenuUtility playerMenuUtility) {
3437
*/
3538
public abstract void loopCode(Object object);
3639

40+
/**
41+
* @return A hashmap of items you want to be placed in the paginated menu border. This will override any items already placed by default. Key = slot, Value = Item
42+
*/
43+
@Nullable
44+
public abstract HashMap<Integer, ItemStack> getCustomMenuBorderItems();
3745

3846
/**
39-
* Set the border and menu buttons for the menu. Override this method to provide a custom menu border
47+
* Set the border and menu buttons for the menu. Override this method to provide a custom menu border or specify custom items in customMenuBorderItems()
4048
*/
4149
protected void addMenuBorder(){
42-
inventory.setItem(48, makeItem(Material.DARK_OAK_BUTTON, ChatColor.GREEN + "Left"));
4350

51+
inventory.setItem(48, makeItem(Material.DARK_OAK_BUTTON, ChatColor.GREEN + "Left"));
4452
inventory.setItem(49, makeItem(Material.BARRIER, ChatColor.DARK_RED + "Close"));
45-
4653
inventory.setItem(50, makeItem(Material.DARK_OAK_BUTTON, ChatColor.GREEN + "Right"));
4754

4855
for (int i = 0; i < 10; i++) {
@@ -63,6 +70,12 @@ protected void addMenuBorder(){
6370
inventory.setItem(i, super.FILLER_GLASS);
6471
}
6572
}
73+
74+
//place the custom items if they exist
75+
if (getCustomMenuBorderItems() != null){
76+
getCustomMenuBorderItems().forEach((integer, itemStack) -> inventory.setItem(integer, itemStack));
77+
}
78+
6679
}
6780

6881
/**

0 commit comments

Comments
 (0)