add other useful methods

This commit is contained in:
Ryder Belserion 2024-09-08 19:15:58 -04:00
parent 5bdd4aae36
commit 3383086e38
No known key found for this signature in database

View File

@ -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<InventoryClickEvent> consumer) {
return new GuiItem(getItemStack(), consumer::accept);
}
public void setItem(final Consumer<InventoryClickEvent> consumer, final PaginatedGui gui) {
gui.setItem(getSlot(), getGuiItem(consumer));
}
}