Skip to content

Koboo/stomui

Repository files navigation

stomui

This library is a very flexible component-based inventory framework for the minestom server framework.

It provides many examples and tries to stay up-to-date.

FAQ

Can I open an inventory to multiple Players? Yes and no. The actual inventories of Minestom are not really visible and backed by a PlayerView. Every player gets an own PlayerView, by opening a ViewComponent, but you could open one ViewComponents instance to multiple players, sharing the logic between multiple PlayerViews.
Do I have to use multiple ViewComponents? No, you can create your inventories with only one ViewProvider. You are not forced to use multiple ViewComponents, but it makes reusing logic within a ViewComponent easier.
Do you support async adding and removing in pagination? Yes, the pagination is very flexible. There are several examples on how to use it. Just look up the examples below.
When is my onRebuild-method executed? The method `PlayerView#executeRebuild()` allows view components to rebuild by themselves. Check out the example to see some usages for that. The method is also executed by the framework itself, if a new PlayerView is opened on a view component.

Documentation

Unfortunately, the actual documentation is still very small, but available in the Wiki.

Examples

To understand the usage of stomui in detail you can check out the examples.

Simple examples

These examples should provide a general overview over the api methods and what is possible with some small code parts.

  • SimpleExampleProvider
    • Shows most of the commonly used ViewProvider/ViewComponent and ViewItem apis and methods.
  • CounterExampleProvider
    • Shows an inventory with a button, which increments an int variable and displays the amount on the items title.
  • CurrentTimeExampleProvider
    • Shows an inventory, which gets updated using the scheduler of Minestom, to set the current time in the inventory's title.

Advanced examples

These examples can help to understand some advanced behaviours of the framework.

Pagination

These examples grant a wide variety of pagination inventories, using pages, scroll rows/columns and even shows how to load items asynchronously.

  • PageableExampleProvider
    • Shows how to use pagination by ViewRegistry#pageable(...) and the ViewComponent hierarchy, by adding children. (Normal page)
  • AsyncPageableExampleProvider
    • Shows how to use pagination by ViewRegistry#pageable(...) (Asynchronous pagination).
  • ScrollableHorizontalExampleProvider
    • Shows how to use pagination by ViewRegistry#scrollable(...) and the ViewComponent hierarchy, by adding children. (Horizontal pattern)
  • ScrollableVerticalExampleProvider
    • Shows how to use pagination by ViewRegistry#scrollable(...) and the ViewComponent hierarchy, by adding children. (Vertical pattern)

Inventory swapping and history

These examples show how to navigate between multiple inventories using navigation calls and history-management.

Extraordinary examples

These examples are somewhat extraordinary and could also be called "proof-of-concept" examples. Do not take them as fully implemented inventories. These only exist to test some very niche stuff, but maybe a good starting point.

  • SearchExampleProvider
    • Pagination example, which shows how to implement a searching inventory using the anvil search input.
  • TwoPlayerExampleProvider
    • Shared ViewProvider by multiple Player, which shows how to open one provider to multiple players.
    • Allows players to have their own PlayerView/inventory but the same logic provided by the ViewProvider.

Template

This project is a copy of minestom-library-template.

Links

About

Flexible inventory framework for minestom

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages