Class VirtualMenu<T>

Object
VirtualMenu<T>
Type Parameters:
T - The contextual data type used to (re)build or adapt the GUI before opening.
All Implemented Interfaces:
VirtualMenuInterface<T>

public abstract class VirtualMenu<T> extends Object implements VirtualMenuInterface<T>
Abstract helper base for creating type-aware (data-driven) virtual menus.

A VirtualMenu<T> wraps a concrete GuiMenuInterface instance and optionally provides a data-bound build method (build(Object)) that can transform / adapt the menu before it is opened for a player using some contextual object of type T.

Typical usage pattern:

 public class ProfileMenu extends VirtualMenu<String> {
     public ProfileMenu(XaGui xaGui) {
         super("Profile", 3, xaGui); // 3 rows, 1 page by default
     }

     @Override
     public GuiMenuInterface build(@NotNull String name) {
         // configure gui buttons based on profile fields
         return build(); // returns the already constructed (base) menu
     }
 }

 // Opening without data (static build):
 new ProfileMenu(xaGui).open(player);

 // Opening with contextual data (dynamic build):
 new ProfileMenu(xaGui).open(player, profileObject);