Refactor and Replace Inventory GUI Framework with Custom DSL-Based System #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch represents a major architectural overhaul of the Surf API's inventory GUI system for the Bukkit platform. The update fully replaces the previously used external
InventoryFramework
dependency with a custom-built GUI framework tailored for extensibility, type safety, and integration into Kotlin-based DSL workflows.Key highlights of this update include:
Removal of Legacy System:
The previous
SurfGui
,SinglePlayerGui
, and all associated InventoryFramework-based DSLs and components (e.g.,SurfGuiItem
,SubmitItemPane
,slot.kt
, etc.) have been entirely removed, eliminating third-party dependency coupling and outdated design patterns.Introduction of New GUI Abstractions:
A new GUI base class (
Gui
) and its extensionNamedGui
provide the foundation for all inventory interfaces. These manage lifecycle, rendering, event delegation, and player-specific behavior like parent navigation and update tracking.DSL Enhancements:
The patch introduces Kotlin-based builders (
menu
,playerMenu
,childMenu
, etc.) that allow developers to construct complex inventories using declarative and readable syntax. It supports typed pane creation viastaticPane
,paginatedPane
, andpagingButtons
.Modular Pane System:
New pane types were added, including:
StaticPane
– for fixed layouts.PaginatedPane
– with integrated page navigation.OutlinePane
– for decorative or border-style layouts.Each pane supports composability and fine-grained item placement via
Slot
utilities.Powerful GUI Items:
A new
GuiItem
abstraction supports UUID-based tracking, permission filtering, visibility toggling, and robust event handling with improved error logging.UpdatableGuiItem
introduces item-level reactivity by enabling live updates inside GUIs.Internal Utilities:
Supporting classes like
InventoryComponent
,PlayerInventoryCache
, andPattern
,Rotatable
,Flippable
utilities enhance layout logic, slot control, and transformation of inventory designs.Improved Event Handling:
All inventory events (clicks, drags, closes) are now internally routed through lambda-based callback systems with isolated error management and stack trace logging.
Versioning and Cleanup:
Version bumped to
1.21.4-2.16.0-SNAPSHOT
. Numerous test files, configuration modules, and legacy Kotlin/Java files have been cleaned up or adapted to the new system, ensuring a consistent and streamlined codebase.This update sets the stage for future extensibility, including custom inventory types, animation support, and advanced GUI tooling without relying on external GUI frameworks. It reflects a deep integration of Kotlin DSL design and a scalable internal GUI engine aligned with Minecraft plugin development best practices.