Skip to content

Commit

Permalink
v2.0.0.6
Browse files Browse the repository at this point in the history
-Fix PageBuilder fill ordering.

Took 3 minutes
  • Loading branch information
Jake-Moore committed Nov 19, 2023
1 parent 88fd9a4 commit fab77bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.kamikazejam</groupId>
<artifactId>kamicommon</artifactId>
<version>2.0.0.5</version>
<version>2.0.0.6</version>
<packaging>jar</packaging>

<name>KamiCommon</name>
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/com/kamikazejam/kamicommon/gui/page/PageBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,9 @@ public KamiMenu createMenu(Player player, int page) {
// Add other icons
addOtherIcons();

// Filler items
KamiMenuItem fillerItem = getFillerIcon();
if (fillerItem != null && fillerItem.getIBuilder() != null && fillerItem.isEnabled()) {
menu.fill(fillerItem.getIBuilder());
}

// If there are no items to add, open the menu
if (!items.exists(page)) {
tryFill();
return menu;
}

Expand All @@ -162,9 +157,20 @@ public KamiMenu createMenu(Player player, int page) {
}

// Return the menu !
tryFill();
return menu;
}

private void tryFill() {
if (menu == null) { return; }

// Filler items
KamiMenuItem fillerItem = getFillerIcon();
if (fillerItem != null && fillerItem.getIBuilder() != null && fillerItem.isEnabled()) {
menu.fill(fillerItem.getIBuilder());
}
}

public void addOtherIcons() {
Collection<KamiMenuItem> otherIcons = supplyOtherIcons();

Expand Down

0 comments on commit fab77bc

Please sign in to comment.