Skip to content

Refactor and Replace Inventory GUI Framework with Custom DSL-Based System #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: version/1.21
Choose a base branch
from

Conversation

ammodev
Copy link
Contributor

@ammodev ammodev commented Jun 13, 2025

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 extension NamedGui 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 via staticPane, paginatedPane, and pagingButtons.

  • 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, and Pattern, 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.

@twisti-dev twisti-dev self-requested a review June 14, 2025 07:53
@twisti-dev twisti-dev moved this from Triage to In progress in Public Bug Tracker Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants