Interface GuiInterpreter
- All Superinterfaces:
GuiEvents
- All Known Implementing Classes:
DefaultInterpreter
Custom GUI interpreter to process XML-based GUI definitions and handle GUI components.
Created: 04/02/2023 Author: Tobias Madlberger (Tobias)
-
Method Summary
Modifier and TypeMethodDescription@NotNull GuiComponent
bindComponent
(@NotNull GuiComponent component, @NotNull GuiEngineApi api, @NotNull GuiContext context) Binds an existing GUI component to the specified GUI context.@NotNull XmlComponent
componentToXml
(@NotNull GuiEngineApi api, @NotNull GuiComponent component) Converts a `GuiComponent` instance into its XML representation.@Nullable GuiComponent
createComponent
(@NotNull XmlComponent xmlComponent, @NotNull GuiEngineApi api, @NotNull GuiContext context) Creates a GUI component based on the provided XML component definition.@NotNull GuiRenderEngine
Retrieves the render engine associated with this interpreter.@NotNull String
Retrieves the unique identifier of the interpreter.@NotNull GuiContext
loadContent
(@NotNull GuiEngineApi api, @NotNull org.bukkit.entity.Player viewer, @NotNull XmlGui xmlGui) Loads the content of a GUI based on the provided XML GUI definition and player viewer.@NotNull XmlComponent
xmlComponent
(@NotNull com.fasterxml.jackson.databind.JsonNode node, @NotNull GuiEngineApi api) Converts a JSON node representing a GUI component into an `XmlComponent` instance.Methods inherited from interface io.github.toberocat.guiengine.event.GuiEvents
clickedComponent, closedComponent, draggedComponent, onViewInit
-
Method Details
-
interpreterId
Retrieves the unique identifier of the interpreter.- Returns:
- The unique identifier of the interpreter.
-
getRenderEngine
Retrieves the render engine associated with this interpreter.- Returns:
- The render engine associated with this interpreter.
-
loadContent
@NotNull @NotNull GuiContext loadContent(@NotNull @NotNull GuiEngineApi api, @NotNull @NotNull org.bukkit.entity.Player viewer, @NotNull @NotNull XmlGui xmlGui) Loads the content of a GUI based on the provided XML GUI definition and player viewer.- Parameters:
api
- The `GuiEngineApi` instance used to interact with the GUI engine.viewer
- The `Player` representing the viewer of the GUI.xmlGui
- The `XmlGui` instance representing the XML definition of the GUI.- Returns:
- The `GuiContext` representing the loaded GUI content.
-
createComponent
@Nullable @Nullable GuiComponent createComponent(@NotNull @NotNull XmlComponent xmlComponent, @NotNull @NotNull GuiEngineApi api, @NotNull @NotNull GuiContext context) Creates a GUI component based on the provided XML component definition.- Parameters:
xmlComponent
- The `XmlComponent` instance representing the XML definition of the component.api
- The `GuiEngineApi` instance used to interact with the GUI engine.context
- The `GuiContext` instance representing the current GUI context.- Returns:
- The `GuiComponent` instance representing the created GUI component.
-
bindComponent
@NotNull @NotNull GuiComponent bindComponent(@NotNull @NotNull GuiComponent component, @NotNull @NotNull GuiEngineApi api, @NotNull @NotNull GuiContext context) Binds an existing GUI component to the specified GUI context.- Parameters:
component
- The `GuiComponent` instance to be bound.api
- The `GuiEngineApi` instance used to interact with the GUI engine.context
- The `GuiContext` instance representing the current GUI context.- Returns:
- The `GuiComponent` instance representing the bound GUI component.
-
xmlComponent
@NotNull @NotNull XmlComponent xmlComponent(@NotNull @NotNull com.fasterxml.jackson.databind.JsonNode node, @NotNull @NotNull GuiEngineApi api) throws com.fasterxml.jackson.core.JsonProcessingException Converts a JSON node representing a GUI component into an `XmlComponent` instance.- Parameters:
node
- The JSON node representing the GUI component.api
- The `GuiEngineApi` instance used to interact with the GUI engine.- Returns:
- The `XmlComponent` instance representing the GUI component.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- if an error occurs during JSON processing.
-
componentToXml
@NotNull @NotNull XmlComponent componentToXml(@NotNull @NotNull GuiEngineApi api, @NotNull @NotNull GuiComponent component) Converts a `GuiComponent` instance into its XML representation.- Parameters:
api
- The `GuiEngineApi` instance used to interact with the GUI engine.component
- The `GuiComponent` instance to be converted.- Returns:
- The `XmlComponent` instance representing the XML representation of the GUI component.
-