From f26277372a2192d6b69b127362fdd37e2b343b19 Mon Sep 17 00:00:00 2001 From: Aquatic Labs <42958451+snow-developer@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:24:41 -0500 Subject: [PATCH] fix: Added static methods, bumped version. --- gradle.properties | 2 +- .../io/fairyproject/bukkit/gui/slot/GuiSlot.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1fe7390d..58aa41e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ # # Fairy -fairy.version = 0.7.1b2-SNAPSHOT +fairy.version = 0.7.1b3-SNAPSHOT gradle-plugin.version = 1.2.0b9 mongojack.version = 4.2.0 diff --git a/io.fairyproject.modules/platform.bukkit/bukkit-gui/src/main/java/io/fairyproject/bukkit/gui/slot/GuiSlot.java b/io.fairyproject.modules/platform.bukkit/bukkit-gui/src/main/java/io/fairyproject/bukkit/gui/slot/GuiSlot.java index 6f711a4e..fa8fee58 100644 --- a/io.fairyproject.modules/platform.bukkit/bukkit-gui/src/main/java/io/fairyproject/bukkit/gui/slot/GuiSlot.java +++ b/io.fairyproject.modules/platform.bukkit/bukkit-gui/src/main/java/io/fairyproject/bukkit/gui/slot/GuiSlot.java @@ -77,18 +77,34 @@ static GuiSlot nextPage(PaginatedPane pane, ItemStack itemStack) { return new ModPageGuiSlot(pane, itemStack, 1, null); } + static GuiSlot nextPage(PaginatedPane pane, ItemStack itemStack, @Nullable BiConsumer clickCallback) { + return new ModPageGuiSlot(pane, itemStack, 1, clickCallback != null ? event -> clickCallback.accept((Player) event.getWhoClicked(), event.getClick()) : null); + } + static GuiSlot previousPage(PaginatedPane pane, ItemStack itemStack) { return new ModPageGuiSlot(pane, itemStack, -1, null); } + static GuiSlot previousPage(PaginatedPane pane, ItemStack itemStack, @Nullable BiConsumer clickCallback) { + return new ModPageGuiSlot(pane, itemStack, -1, clickCallback != null ? event -> clickCallback.accept((Player) event.getWhoClicked(), event.getClick()) : null); + } + static GuiSlot nextPage(PaginatedPane pane) { return new ModPageGuiSlot(pane, ItemBuilder.of(XMaterial.ARROW).name("&aNext Page").build(), 1, null); } + static GuiSlot nextPage(PaginatedPane pane, @Nullable BiConsumer clickCallback) { + return new ModPageGuiSlot(pane, ItemBuilder.of(XMaterial.ARROW).name("&aNext Page").build(), 1, clickCallback != null ? event -> clickCallback.accept((Player) event.getWhoClicked(), event.getClick()) : null); + } + static GuiSlot previousPage(PaginatedPane pane) { return new ModPageGuiSlot(pane, ItemBuilder.of(XMaterial.ARROW).name("&aPrevious Page").build(), -1, null); } + static GuiSlot previousPage(PaginatedPane pane, @Nullable BiConsumer clickCallback) { + return new ModPageGuiSlot(pane, ItemBuilder.of(XMaterial.ARROW).name("&aPrevious Page").build(), -1, clickCallback != null ? event -> clickCallback.accept((Player) event.getWhoClicked(), event.getClick()) : null); + } + static GuiSlot modPage(PaginatedPane pane, ItemStack itemStack, int mod, @Nullable BiConsumer clickCallback) { return new ModPageGuiSlot(pane, itemStack, mod, clickCallback != null ? event -> clickCallback.accept((Player) event.getWhoClicked(), event.getClick()) : null); }