Package eu.xap3y.xagui
Class GuiRegistry<K>
Object
GuiRegistry<K>
- Type Parameters:
K- key type used to identify registered menus (e.g. enum, string, UUID)
Registry for mapping arbitrary keys to
VirtualMenu instances.
Provides:
- Registration of typed virtual menus
- Safe retrieval by key + expected data class
- Invocation helpers to build and open menus (with or without context)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> VirtualMenu<T> Retrieve a previously registered virtual menu if the requested context type is compatible.voidBuild (static) and open a menu registered under a key (no context object).<T> voidBuild (context-aware) and open a menu registered under a key with a context object.<T> voidregister(K key, VirtualMenu<T> guiMenu, Class<T> clazz) Register a new virtual menu under a key.
-
Constructor Details
-
GuiRegistry
public GuiRegistry()
-
-
Method Details
-
register
Register a new virtual menu under a key.- Type Parameters:
T- context type for the virtual menu- Parameters:
key- registry keyguiMenu- virtual menu instanceclazz- expected context class for type-safety checks
-
get
Retrieve a previously registered virtual menu if the requested context type is compatible.- Type Parameters:
T- context type- Parameters:
key- registry keyclazz- expected context class- Returns:
- the virtual menu cast to the requested type, or
nullif not found / incompatible
-
invoke
Build (static) and open a menu registered under a key (no context object).- Parameters:
key- registry keyplayer- target player
-
invoke
-