Interface GuiLayoutRegistry
public interface GuiLayoutRegistry
Registry for external plugins to register custom GUI layouts.
Obtain an instance via
SmartSpawnerAPI.getLayoutRegistry().
Registered layouts can be selected in the main config.yml using the
gui_layout setting, just like built-in file-based layouts.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a set of all registered layout names.booleanisRegistered(String layoutName) Checks whether a layout name is already registered.booleanregisterLayout(String layoutName, @Nullable GuiLayoutData mainGui, @Nullable GuiLayoutData storageGui, @Nullable GuiLayoutData sellConfirmGui) Registers a programmatic layout (built viaGuiLayoutBuilder).booleanregisterLayoutFromYaml(String layoutName, @Nullable File mainGuiFile, @Nullable File storageGuiFile, @Nullable File sellConfirmGuiFile) Registers a layout from YAML files provided by an external plugin.booleanunregisterLayout(String layoutName) Unregisters a previously registered layout.
-
Method Details
-
registerLayout
boolean registerLayout(String layoutName, @Nullable @Nullable GuiLayoutData mainGui, @Nullable @Nullable GuiLayoutData storageGui, @Nullable @Nullable GuiLayoutData sellConfirmGui) Registers a programmatic layout (built viaGuiLayoutBuilder). Any of the layout parameters may be null if the external plugin does not wish to override that specific GUI type.- Parameters:
layoutName- the unique layout name (used in config.ymlgui_layout)mainGui- the main GUI layout, or nullstorageGui- the storage GUI layout, or nullsellConfirmGui- the sell confirmation GUI layout, or null- Returns:
- true if registered successfully, false if name already taken
-
registerLayoutFromYaml
boolean registerLayoutFromYaml(String layoutName, @Nullable @Nullable File mainGuiFile, @Nullable @Nullable File storageGuiFile, @Nullable @Nullable File sellConfirmGuiFile) Registers a layout from YAML files provided by an external plugin. The YAML format must match the built-in SmartSpawner layout files.- Parameters:
layoutName- the unique layout namemainGuiFile- the main GUI YAML file, or nullstorageGuiFile- the storage GUI YAML file, or nullsellConfirmGuiFile- the sell confirm GUI YAML file, or null- Returns:
- true if registered successfully, false if name already taken or files invalid
-
unregisterLayout
Unregisters a previously registered layout.- Parameters:
layoutName- the layout name to unregister- Returns:
- true if unregistered, false if not found
-
isRegistered
Checks whether a layout name is already registered.- Parameters:
layoutName- the layout name to check- Returns:
- true if registered
-
getRegisteredLayouts
-