From 3383086e383b9a4fb123d583a5b71526cfc3a17c Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Sun, 8 Sep 2024 19:15:58 -0400 Subject: [PATCH] add other useful methods --- .../configs/beans/ButtonProperty.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/paper/src/main/java/com/badbones69/crazyauctions/configs/beans/ButtonProperty.java b/paper/src/main/java/com/badbones69/crazyauctions/configs/beans/ButtonProperty.java index 41a84b0..cdcdac1 100644 --- a/paper/src/main/java/com/badbones69/crazyauctions/configs/beans/ButtonProperty.java +++ b/paper/src/main/java/com/badbones69/crazyauctions/configs/beans/ButtonProperty.java @@ -1,7 +1,13 @@ package com.badbones69.crazyauctions.configs.beans; import ch.jalu.configme.Comment; +import com.ryderbelserion.vital.paper.api.builders.gui.interfaces.GuiItem; +import com.ryderbelserion.vital.paper.api.builders.gui.types.PaginatedGui; +import com.ryderbelserion.vital.paper.api.builders.items.ItemBuilder; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; import java.util.List; +import java.util.function.Consumer; public class ButtonProperty { @@ -94,4 +100,16 @@ public class ButtonProperty { public int getSlot() { return this.slot; } + + public final ItemStack getItemStack() { + return new ItemBuilder<>().withType(getMaterial()).setDisplayName(getDisplayName()).setDisplayLore(getDisplayLore()).getStack(); + } + + public final GuiItem getGuiItem(final Consumer consumer) { + return new GuiItem(getItemStack(), consumer::accept); + } + + public void setItem(final Consumer consumer, final PaginatedGui gui) { + gui.setItem(getSlot(), getGuiItem(consumer)); + } } \ No newline at end of file