From 7f13c5abb8eae21d5af6bfced1a9ddd544f71450 Mon Sep 17 00:00:00 2001 From: Jake Moore Date: Thu, 29 Aug 2024 22:51:22 -0700 Subject: [PATCH] v3.5.0.1 -Fix addPagedItem methods in PagedKamiMenu requiring slot (which has no meaning) Took 3 minutes --- build.gradle.kts | 2 +- .../command/internal/CmdOpenGUI.java | 4 +-- .../kamicommon/gui/page/PagedKamiMenu.java | 32 +++++-------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d1907449..b52a6b02 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import java.util.* @Suppress("PropertyName") -var VERSION = "3.5.0.0" +var VERSION = "3.5.0.1" plugins { // needed for the subprojects section to work id("java") diff --git a/spigot-jar/src/main/java/com/kamikazejam/kamicommon/command/internal/CmdOpenGUI.java b/spigot-jar/src/main/java/com/kamikazejam/kamicommon/command/internal/CmdOpenGUI.java index ff602f8b..648f16f9 100644 --- a/spigot-jar/src/main/java/com/kamikazejam/kamicommon/command/internal/CmdOpenGUI.java +++ b/spigot-jar/src/main/java/com/kamikazejam/kamicommon/command/internal/CmdOpenGUI.java @@ -56,7 +56,7 @@ private void openPaged(@NotNull Player player) { for (int i = 1; i < 45; i++) { String id = "Item" + i; IBuilder builder = new ItemBuilder(XMaterial.STONE).setName("&fItem &7#" + i); - paged.addPagedItem(builder, i).setMenuClick((p, c) -> + paged.addPagedItem(builder).setMenuClick((p, c) -> p.sendMessage(StringUtil.t("&7Paged Item Click (&f" + c.name() + "&7) on &f" + id)) ); } @@ -73,7 +73,7 @@ private void openPaged2(@NotNull Player player) { for (int i = 1; i < 45; i++) { String id = "Item" + i; IBuilder builder = new ItemBuilder(XMaterial.STONE).setName("&fItem &7#" + i); - paged.addPagedItem(builder, i).setMenuClick((p, c) -> + paged.addPagedItem(builder).setMenuClick((p, c) -> p.sendMessage(StringUtil.t("&7Paged Item Click (&f" + c.name() + "&7) on &f" + id)) ); } diff --git a/spigot-jar/src/main/java/com/kamikazejam/kamicommon/gui/page/PagedKamiMenu.java b/spigot-jar/src/main/java/com/kamikazejam/kamicommon/gui/page/PagedKamiMenu.java index cedd50ae..ea6dd5b6 100644 --- a/spigot-jar/src/main/java/com/kamikazejam/kamicommon/gui/page/PagedKamiMenu.java +++ b/spigot-jar/src/main/java/com/kamikazejam/kamicommon/gui/page/PagedKamiMenu.java @@ -96,37 +96,21 @@ public void setNextIconSlot(@NotNull ItemSlot slot) { // Item Management // // ------------------------------------------------------------ // @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull IBuilder builder, int slot) { - return this.addPagedItem(new MenuItem(true, new StaticItemSlot(slot), builder)); + public @NotNull MenuItem addPagedItem(@NotNull IBuilder builder) { + return this.addPagedItem(new MenuItem(true, new StaticItemSlot(-1), builder)); } @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull IBuilder builder, @NotNull ItemSlot slot) { - return this.addPagedItem(new MenuItem(true, slot, builder)); - } - @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull ItemStack stack, int slot) { - return this.addPagedItem(new MenuItem(true, new StaticItemSlot(slot), new ItemBuilder(stack))); - } - @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull ItemStack stack, @NotNull ItemSlot slot) { - return this.addPagedItem(new MenuItem(true, slot, new ItemBuilder(stack))); + public @NotNull MenuItem addPagedItem(@NotNull ItemStack stack) { + return this.addPagedItem(new MenuItem(true, new StaticItemSlot(-1), new ItemBuilder(stack))); } @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull IBuilder builder, int slot) { - return this.addPagedItem(new MenuItem(true, new StaticItemSlot(slot), builder).setId(id)); - } - @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull ItemStack stack, int slot) { - return this.addPagedItem(new MenuItem(true, new StaticItemSlot(slot), new ItemBuilder(stack)).setId(id)); - } - @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull IBuilder builder, @NotNull ItemSlot slot) { - return this.addPagedItem(new MenuItem(true, slot, builder).setId(id)); + public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull IBuilder builder) { + return this.addPagedItem(new MenuItem(true, new StaticItemSlot(-1), builder).setId(id)); } @CheckReturnValue - public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull ItemStack stack, @NotNull ItemSlot slot) { - return this.addPagedItem(new MenuItem(true, slot, new ItemBuilder(stack)).setId(id)); + public @NotNull MenuItem addPagedItem(@NotNull String id, @NotNull ItemStack stack) { + return this.addPagedItem(new MenuItem(true, new StaticItemSlot(-1), new ItemBuilder(stack)).setId(id)); } @CheckReturnValue