From 79c2d8c87c490b8ea87289c16ed010d8f3ac2356 Mon Sep 17 00:00:00 2001 From: Jake Moore Date: Tue, 17 Oct 2023 03:22:40 -0700 Subject: [PATCH] v1.8.3.2 - Fix something --- pom.xml | 2 +- .../kamikazejamplugins/kamicommon/gui/AbstractKamiMenu.java | 6 ++++++ .../com/kamikazejamplugins/kamicommon/gui/KamiMenu.java | 2 +- .../kamikazejamplugins/kamicommon/gui/interfaces/Menu.java | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dd0b36f5..ea75947a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.kamikazejamplugins kamicommon - 1.8.3.1 + 1.8.3.2 jar KamiCommon diff --git a/src/main/java/com/kamikazejamplugins/kamicommon/gui/AbstractKamiMenu.java b/src/main/java/com/kamikazejamplugins/kamicommon/gui/AbstractKamiMenu.java index a6b53402..6b2fea8e 100644 --- a/src/main/java/com/kamikazejamplugins/kamicommon/gui/AbstractKamiMenu.java +++ b/src/main/java/com/kamikazejamplugins/kamicommon/gui/AbstractKamiMenu.java @@ -34,6 +34,7 @@ public abstract class AbstractKamiMenu extends MenuHolder implements Menu { private Consumer closeHandler; private Consumer instantCloseHandler; private MenuUpdate updateHandler; + private boolean clearBeforeUpdate = false; private boolean allowItemPickup; public AbstractKamiMenu() {} @@ -134,5 +135,10 @@ public void setUpdateHandler(MenuUpdate updateHandler) { MenuTask.getAutoUpdateInventories().add(this); } + @Override + public void setClearBeforeUpdate(boolean b) { + this.clearBeforeUpdate = b; + } + public abstract void setItem(int slot, IBuilder stack, Player forPlaceholders); } diff --git a/src/main/java/com/kamikazejamplugins/kamicommon/gui/KamiMenu.java b/src/main/java/com/kamikazejamplugins/kamicommon/gui/KamiMenu.java index c30929c0..21f267a9 100644 --- a/src/main/java/com/kamikazejamplugins/kamicommon/gui/KamiMenu.java +++ b/src/main/java/com/kamikazejamplugins/kamicommon/gui/KamiMenu.java @@ -29,7 +29,7 @@ public void update() { MenuUpdate menuUpdate = getUpdateHandler(); if (menuUpdate != null) { - clear(); + if (isClearBeforeUpdate()) { clear(); } menuUpdate.onUpdate(); } } diff --git a/src/main/java/com/kamikazejamplugins/kamicommon/gui/interfaces/Menu.java b/src/main/java/com/kamikazejamplugins/kamicommon/gui/interfaces/Menu.java index 733dfd37..69331e3d 100644 --- a/src/main/java/com/kamikazejamplugins/kamicommon/gui/interfaces/Menu.java +++ b/src/main/java/com/kamikazejamplugins/kamicommon/gui/interfaces/Menu.java @@ -73,6 +73,8 @@ default void setItem(IBuilder stack, int slot, Player forPlaceholders) { void setUpdateHandler(MenuUpdate update); + void setClearBeforeUpdate(boolean clearBeforeUpdate); + void update(); void setAutoUpdate();