OdalitaMenus icon indicating copy to clipboard operation
OdalitaMenus copied to clipboard

Unfinished wiki

Open Optimal1 opened this issue 1 year ago • 2 comments

Can I ask you to finish the wiki (pagination, iterators etc.) And you could add an event for closing and opening the menu.

Optimal1 avatar Dec 25 '23 12:12 Optimal1

Hey! Yeah I will update the wiki after christmas! And closing event is already present, using MenuContents#events()#onClose(). Every time a player opens a menu, onLoad is called in the MenuProvider, so it's already present, but not in the form of an event.

kiwisap avatar Dec 25 '23 22:12 kiwisap

Thanks for the answer and also for the useful features in the library.

Optimal1 avatar Dec 25 '23 23:12 Optimal1

I have a question. I previously used a different inventory framework that supported asynchronous pagination.

However, I couldn't find information on whether or how this works here. In that framework, you could use a CompletableFuture—for example, fetchClansFromDatabase, which would return a list of clans and then process it further, as shown here: https://github.com/DevNatan/inventory-framework/wiki/Pagination#asynchronous-data-source

Is this also possible here? If so, how?

ch4ika avatar Oct 13 '24 20:10 ch4ika

I have a question. I previously used a different inventory framework that supported asynchronous pagination.

However, I couldn't find information on whether or how this works here. In that framework, you could use a CompletableFuture—for example, fetchClansFromDatabase, which would return a list of clans and then process it further, as shown here: https://github.com/DevNatan/inventory-framework/wiki/Pagination#asynchronous-data-source

Is this also possible here? If so, how?

Yes this is possible! Look at the example ObjectPaginationExampleMenu, you can create the pagination and iterator. The addItem supports asynchronous, so you could just add all result objects in the .whenComplete of the observable to the pagination. The batch is optional, but can be used to set all items at once in the menu, to increase a little bit of performance when using filters / sorters. We don't have anything to handle the CompletableFuture, so that's something you have to manage on your end.

Hope this answers your question, let me know if you have any more!

kiwisap avatar Oct 14 '24 17:10 kiwisap