Skip to content

Overview

aparx edited this page Dec 28, 2023 · 7 revisions

Contents

  1. Idea behind bukkit-gui
  2. Terminology

Idea behind bukkit-gui

The idea behind bukkit-gui is to be able to easily create user interfaces that scale and can vary in complexity, even dynamically.

The core consists of a primary wrapper CustomInventory that wraps around a content attribute InventoryContentView acting as an abstract adapter that can represent anything within a 2D pane. The idea is that developers can easily swap out content for anything content related if they want to.

CustomInventory and the builder

The CustomInventory is a manging class for a single Bukkit inventory that can be shown to an arbitrary number of players (also called viewers) simultaneously. It is updated internally in a certain interval. Inventories can be built manually (recommended for complex applications) or using an inventory builder called CustomInventoryBuilder.

For more read here

InventoryItem

A custom inventory also needs to contain items a viewer can interact with. For this we have InventoryItem, representing a potentially interactable item, that also can act as an ItemStack factory.

For more read here

The different groups

As already mentioned above, a content attribute represents the head of all content within a custom inventory. There is a bunch of different default views (referring to content), that basically enable everything you will ever need for your inventories. Here an overview:

  1. InventoryStorageLayer
    This is the most important one, since it is basically representing what the player sees and interacts with (or leaf in a tree of content view nodes). It is a register for InventoryItems at specific locations.
    Populator: InventoryStoragePopulator
  2. InventoryLayerGroup
    As the name suggests, it is a collection of ordered layers, that themselves are also just InventoryContentView instances. Using the layer group you can theoretically add many trees of views.
    Populator: InventoryLayerPopulator
  3. InventoryPageGroup
    This is a group that automatically handles pagination based off of the (manually inserted) pages you give it. You can easily add, remove and handle pages. Even edit everything pagination related if you want to. A page is also just any content view.
    Populator: InventoryPagePopulator
  4. InventoryDynamicPageGroup
    This is a group that is somewhat similar to the InventoryPageGroup, in the essence that it is a wrapper around a page group. It automatically handles creation and deletion of pages when you add or remove elements that should be visible within the inventory. It provides the same and more options like a page group.
    Populator: InventoryDynamicPagePopulator

With that you have an overview of the most important layers and content views.

Terminology

  • View and content view
    Content view and view are used equivalently and represent the abstract content view, that acts as the content displayed in an inventory.

Clone this wiki locally