From fab77bc5bd6405c43ccf81bb629b249e7a12b906 Mon Sep 17 00:00:00 2001 From: Jake Moore Date: Sun, 19 Nov 2023 02:25:58 -0800 Subject: [PATCH] v2.0.0.6 -Fix PageBuilder fill ordering. Took 3 minutes --- pom.xml | 2 +- .../kamicommon/gui/page/PageBuilder.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 27bc25f2..0d61192d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.kamikazejam kamicommon - 2.0.0.5 + 2.0.0.6 jar KamiCommon diff --git a/src/main/java/com/kamikazejam/kamicommon/gui/page/PageBuilder.java b/src/main/java/com/kamikazejam/kamicommon/gui/page/PageBuilder.java index a87dfd59..5efd107f 100644 --- a/src/main/java/com/kamikazejam/kamicommon/gui/page/PageBuilder.java +++ b/src/main/java/com/kamikazejam/kamicommon/gui/page/PageBuilder.java @@ -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; } @@ -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 otherIcons = supplyOtherIcons();