triumph-gui Documentation
repository·master·Indexed 19 days ago
https://github.com/triumphteam/triumph-guiA Java library available via Maven Central designed to simplify the creation of Graphical User Interfaces (GUIs). It features the GuiContainer interface for managing GUI structures, including Chest-based containers with row-based sizing and Typed containers based on specific GuiType definitions.
What's inside triumph-gui
- triumph-gui is a library designed to simplify the creation of Graphical User Interfaces (GUIs). It is available via Maven Central for Java developers.
Install triumph-gui via Maven
masterYou can include triumph-gui in your Java project by using the Maven dependency coordinates. The artifact is hosted on Maven Central under the group ID
dev.triumphteam.<!-- Reference to Maven Central --> https://search.maven.org/artifact/dev.triumphteam/triumph-guiUse the GuiContainer interface to manage GUI structures
masterThe
GuiContainerinterface defines the blueprint for creating and managing GUI inventories (such as Chests or Typed inventories) in the Triumph-GUI library. It provides methods to manage the display title, determine the inventory size and row count, and identify theGuiType. To actually instantiate a BukkitInventory, you use thecreateInventory(InventoryHolder inventoryHolder)method, which relies on an underlyingInventoryProviderimplementation.// Conceptual usage of a GuiContainer GuiContainer container = ...; Inventory inventory = container.createInventory(player);Implement a Typed GUI container
masterThe
Typedimplementation ofGuiContainerallows for creating inventories based on a specificGuiType. Unlike theChestimplementation which uses rows to determine size, theTypedcontainer uses theGuiTypeto determine both the inventory size (viaguiType.getLimit()) and the specific inventory type (viaguiType.getInventoryType()).// Example of creating a Typed container GuiContainer typed = new GuiContainer.Typed( Component.text("Typed GUI"), typedInventoryProvider, // An implementation of InventoryProvider.Typed GuiType.PLAYER_HEAD // A specific GuiType );Implement a Chest-based GUI container
masterThe
Chestimplementation ofGuiContainerrepresents a standard chest-style inventory. It is defined by a title, a specific number of rows, and anInventoryProvider.Chestto handle the actual inventory creation. The inventory size is automatically calculated asrows * 9.// Example of creating a Chest container GuiContainer chest = new GuiContainer.Chest( Component.text("My Chest GUI"), chestInventoryProvider, // An implementation of InventoryProvider.Chest 3 // Number of rows );