Closed NotroDev closed 2 years ago
What exactly are you trying to achieve with this?
What exactly are you trying to achieve with this?
I have a GUI to put items in, then I want to save them, for example to the ItemStack list
PS. And, let me add that I need to configure the page buttons, e.g. replace icons or text, could you add that? I think I can do it manually by editing getInventory(), but it would be appreciated anyway.
PS. And, let me add that I need to configure the page buttons, e.g. replace icons or text, could you add that? I think I can do it manually by editing getInventory(), but it would be appreciated anyway.
Ah, okay, sorry!
// Idk how to use it xd
Okay, items in close event solved - i've used bukkit event. But now, i can't make this work:
SGPaginationButtonBuilder builder = Main.instance.spiGUI.getDefaultPaginationButtonBuilder();
builder.buildPaginationButton(SGPaginationButtonType.CURRENT_BUTTON, shopMenu).setIcon(new ItemBuilder(Material.EMERALD).build());
shopMenu.setPaginationButtonBuilder(builder);
Okay, items in close event solved - i've used bukkit event. But now, i can't make this work:
SGPaginationButtonBuilder builder = Main.instance.spiGUI.getDefaultPaginationButtonBuilder(); builder.buildPaginationButton(SGPaginationButtonType.CURRENT_BUTTON, shopMenu).setIcon(new ItemBuilder(Material.EMERALD).build()); shopMenu.setPaginationButtonBuilder(builder);
buildPaginationButton
is used internally by SpiGUI to render the pagination buttons, you wouldn't usually call it as you are here.
What you would instead do is create your own SGPaginationButtonBuilder, similar to the way SpiGUI does it internally and then use setPaginationButtonBuilder
to use your created pagination button builder instead.
For any buttons you don't want to override (let's say you're only overriding CURRENT_BUTTON
, you could use the default instead by simply calling Main.instance.spiGUI.getDefaultPaginationButtonBuilder().buildPaginationButton
inside your own pagination builder (e.g., in the default block of the switch/case).
Overall this API is a bit of a mess and won't even let you add new buttons - you can only override existing ones which is a bit of a silly oversight on my part. I will try and work on fixing it today if I have time.
Will also double check onClose
functionality.
Thanks, it's working perfectly.
Hi.
This code:
clears my inventory, because getInventory in this event is empty... Can i somehow get it contents? Or maybe this is just wrong?