### Accessing and Managing GUI Components with ComponentGroup (Kotlin) Source: https://context7.com/julyss2019/jerm/llms.txt Illustrates how to retrieve components by ID or path, check for their existence, remove them, add new components, clear all components, and get a string representation of the component hierarchy. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.component.* val gui = Jerm.getGuiManager().getGui2("inventory-gui") // Get component by ID (returns null if not found) val buttonOrNull = gui.getComponent2OrNull("buy-button", Button::class.java) // Get component by ID (throws exception if not found) val button = gui.getComponent2("buy-button", Button::class.java) // Get component by path (dot notation for nested components) val nestedLabel = gui.getComponentByPath2("container.header.title", Label::class.java) // Get all direct components val components = gui.components println("Direct components: ${components.size}") // Get all components recursively (including nested) val allComponents = gui.getComponentsRecursively() allComponents.forEach { component -> println("Component: ${component.id} at path: ${component.path}") } // Check if component exists if (gui.existsComponent("submit-button")) { println("Submit button found") } // Remove a component val componentToRemove = gui.getComponent2("old-label", Label::class.java) gui.removeComponent(componentToRemove) // Remove by ID gui.removeComponent("deprecated-button") // Add a component fun addNewComponent(component: Component<*>) { gui.addComponent(component) } // Clear all components gui.clearComponents() // Get hierarchy string for debugging val hierarchy = gui.getHierarchyString() println(hierarchy) ``` -------------------------------- ### Managing GUI Screens with Event Listeners (Kotlin) Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to retrieve a GUI, set open, close, and click listeners, and open the GUI for players in various modes (full-screen, HUD). It also shows how to enable/disable the GUI. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.Gui import com.void01.bukkit.jerm.api.common.gui.component.Component import com.germ.germplugin.api.event.gui.GermGuiClickEvent import org.bukkit.entity.Player val gui = Jerm.getGuiManager().getGui2("shop-gui") // Set open listener gui.onOpenListener = object : Gui.OnOpenListener { override fun onOpen() { println("GUI ${gui.id} was opened") } } // Set close listener (triggered when client responds, not immediately on close()) gui.onCloseListener = object : Gui.OnCloseListener { override fun onClose() { println("GUI ${gui.id} was closed") } } // Set click listener for GUI-level clicks gui.onGuiClickListener = object : Gui.OnClickListener { override fun onClickDown(component: Component<*>?, clickType: Component.ClickType, event: GermGuiClickEvent) { component?.let { println("Clicked component: ${it.id} with ${clickType.name}") } } override fun onClickUp(component: Component<*>?, clickType: Component.ClickType, event: GermGuiClickEvent) { // Handle mouse button release } } // Open GUI for a player fun openShopForPlayer(player: Player) { val jermPlayer = Jerm.getPlayerManager().getJermPlayer(player) // Clone GUI for unique instance per player val playerGui = gui.clone() // Open as full-screen GUI (covers the game) playerGui.openAsGui(jermPlayer) // Or open as GUI with cover option playerGui.openAsGui(player, isCover = true) // Or open as HUD overlay (game visible behind) playerGui.openAsHud(player) } // Close the GUI fun closeGui() { gui.close() } // Enable/disable GUI gui.isEnabled = false // Disable gui.isEnabled = true // Enable ``` -------------------------------- ### Configure and Handle Button Component Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to retrieve a Button component, set textures and multi-line text, and implement click listeners for various mouse actions. ```kotlin val gui = Jerm.getGuiManager().getGui2("shop-gui") val buyButton = gui.getComponent2("buy-button", Button::class.java) buyButton.texturePath = "textures/buttons/buy_normal.png" buyButton.hoverTexturePath = "textures/buttons/buy_hover.png" buyButton.setTexts("Buy Item", "Price: 100 coins") buyButton.onClickListener = object : Component.OnClickListener { override fun onClick(clickType: Component.ClickType) { when (clickType) { Component.ClickType.LEFT -> println("Left click on buy button") } } override fun onClickDown(clickType: Component.ClickType) { println("Button pressed down") } override fun onClickUp(clickType: Component.ClickType) { println("Button released") } } ``` -------------------------------- ### Configuring ItemSlot Component Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to retrieve an ItemSlot component, set its ItemStack, configure interactivity, and handle click events. It also shows how to bind the slot to inventory systems and clone the component. ```kotlin val gui = Jerm.getGuiManager().getGui2("inventory-gui") val itemSlot = gui.getComponent2("item-display", ItemSlot::class.java) itemSlot.itemStack = ItemStack(Material.DIAMOND_SWORD) itemSlot.isInteractive = true itemSlot.isViewOnly = false itemSlot.binding = "player-inventory-slot-0" itemSlot.onClickListener = object : Component.OnClickListener { override fun onClick(clickType: Component.ClickType, isShift: Boolean) { when (clickType) { Component.ClickType.LEFT -> println("Picked up item") Component.ClickType.RIGHT -> println("Right-clicked item") Component.ClickType.MIDDLE -> println("Middle-clicked item") } } } ``` -------------------------------- ### Configure Input Component Fields Source: https://context7.com/julyss2019/jerm/llms.txt Explains how to set up text and numeric input fields, configure character limits, and enable server synchronization. ```kotlin val nameInput = gui.getComponent2("player-name-input", Input::class.java) nameInput.type = Input.Type.TEXT nameInput.maxLength = 16 nameInput.isSync = true nameInput.value = "DefaultName" ``` -------------------------------- ### Manage GUI Components and Click Events in Jerm Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to retrieve a component from a GUI, manage its state, configure tooltips, and implement comprehensive click listeners. It also shows how to access sub-components and clone existing UI elements. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.component.Component import com.void01.bukkit.jerm.api.common.gui.component.Button import org.bukkit.event.Event val gui = Jerm.getGuiManager().getGui2("demo-gui") val component = gui.getComponent2("any-component", Button::class.java) // Common properties available on all components println("ID: ${component.id}") println("Path: ${component.path}") println("Parent: ${component.parent?.id}") println("GUI: ${component.gui.id}") // Tooltips (hover text) component.tooltips = listOf("Line 1 tooltip", "Line 2 tooltip") // Enable/disable component component.disable() // or component.isEnabled = false component.enable() // or component.isEnabled = true // Set click listener (common to all components) component.onClickListener = object : Component.OnClickListener { override fun onClick(clickType: Component.ClickType) { println("Clicked: ${clickType.name}") } override fun onClick(clickType: Component.ClickType, isShift: Boolean) { println("Clicked with shift=$isShift") } override fun onClick(clickType: Component.ClickType, isShift: Boolean, event: Event) { println("Full click event received") } override fun onClickDown(clickType: Component.ClickType) { println("Mouse button pressed") } override fun onClickUp(clickType: Component.ClickType) { println("Mouse button released") } } // Access pseudo-components (sub-components) val pseudoComponent = component.getPseudoComponent("sub-element", Component::class.java) val requiredPseudo = component.getPseudoComponentOrThrow("required-sub", Component::class.java) // Clone component val cloned = component.clone() cloned.id = "cloned-component" ``` -------------------------------- ### Parsing GUIs from YAML Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to parse GUI definitions from external YAML files or YamlConfiguration objects using the GuiParser interface. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import org.bukkit.configuration.file.YamlConfiguration import java.io.File val guiParser = Jerm.getGuiParser() // Parse all GUIs from a file val guiFile = File(dataFolder, "guis/shop.yml") val guis = guiParser.parseGuis(guiFile) guis.forEach { gui -> println("Parsed GUI: ${gui.id}") } // Parse a specific GUI by ID from a file val shopGui = guiParser.parseGui(guiFile, "main-shop") // Parse from YamlConfiguration object val yamlConfig = YamlConfiguration.loadConfiguration(guiFile) val guisFromYaml = guiParser.parseGuis(yamlConfig) // Parse specific GUI from YamlConfiguration val specificGui = guiParser.parseGui(yamlConfig, "inventory-gui") ``` -------------------------------- ### GUI Lifecycle Management Source: https://context7.com/julyss2019/jerm/llms.txt Methods for initializing, listening to events, and displaying GUI screens or HUD overlays to players. ```APIDOC ## GUI Lifecycle Management ### Description Manage the lifecycle of a GUI screen including opening, closing, and handling interaction events like clicks. ### Method N/A (Kotlin API) ### Endpoint com.void01.bukkit.jerm.api.common.gui.Gui ### Parameters #### Path Parameters - **guiId** (String) - Required - The unique identifier of the GUI template. ### Request Example val gui = Jerm.getGuiManager().getGui2("shop-gui") gui.openAsGui(player, isCover = true) ### Response #### Success Response (200) - **status** (Boolean) - Returns true if the GUI operation was successfully initiated. ``` -------------------------------- ### Accessing Jerm API Managers Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to access core managers like GUI, animation, player, and parser using both method-based (Jerm) and property-based (Jerm2) access patterns. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.Jerm2 // Using Jerm object (method-based access) val guiManager = Jerm.getGuiManager() val animationManager = Jerm.getAnimationManager() val playerManager = Jerm.getPlayerManager() val guiParser = Jerm.getGuiParser() // Using Jerm2 object (property-based access for Java interop) val guiManager2 = Jerm2.guiManager val animationManager2 = Jerm2.animationManager val playerManager2 = Jerm2.jermPlayerManager val guiParser2 = Jerm2.guiParser ``` -------------------------------- ### Track Player GUI State with JermPlayer Source: https://context7.com/julyss2019/jerm/llms.txt Explains how to query currently open GUIs for a specific player and safely interact with them using the JermPlayer interface. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import org.bukkit.entity.Player fun managePlayerGuis(player: Player) { val jermPlayer = Jerm.getPlayerManager().getJermPlayer(player) val openGuis = jermPlayer.getUsingGuis() println("Player has ${openGuis.size} GUIs open") val shopGui = jermPlayer.getUsingGuiOrNull("shop-gui") shopGui?.let { println("Shop GUI is open") } try { val inventoryGui = jermPlayer.getUsingGui("inventory-gui") inventoryGui.close() } catch (e: Exception) { println("Inventory GUI is not open") } val bukkitPlayer = jermPlayer.bukkitPlayer bukkitPlayer.sendMessage("Your GUI state has been checked!") } ``` -------------------------------- ### Implement Animated ProgressBar in Jerm GUI Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to create horizontal and vertical progress bars, set progress values, and customize animation easing and duration functions. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.component.Texture import com.void01.bukkit.jerm.api.common.gui.extension.component.ProgressBar val gui = Jerm.getGuiManager().getGui2("game-gui") val guiManager = Jerm.getGuiManager() val healthBarTexture = gui.getComponent2("health-bar-texture", Texture::class.java) val healthBar = guiManager.createHorizontalProgressBar(healthBarTexture) healthBar.orientation = ProgressBar.Orientation.HORIZONTAL val manaBarTexture = gui.getComponent2("mana-bar-texture", Texture::class.java) val manaBar = guiManager.createVerticalProgressBar(manaBarTexture) manaBar.orientation = ProgressBar.Orientation.VERTICAL healthBar.setProgress(0.8) manaBar.setProgressSmoothly(0.5) healthBar.animationEaseFunction = object : ProgressBar.AnimationEaseFunction { override fun calculate(originalProgress: Double): Double { return 1 - (1 - originalProgress) * (1 - originalProgress) } } healthBar.animationDurationFunction = object : ProgressBar.AnimationDurationFunction { override fun calculate(deltaProgress: Double): Double { return deltaProgress * 0.5 } } healthBar.maxWidth = "200" healthBar.maxHeight = "20" healthBar.maxEndU = 200 healthBar.maxEndV = 20 ``` -------------------------------- ### Manage Entity Animations with Jerm API Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates how to list animations, play them to specific viewers or nearby players, and use PreparedAnimation objects for pre-configured playback settings. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.animation.PreparedAnimation import org.bukkit.entity.Entity import org.bukkit.entity.Player val animationManager = Jerm.getAnimationManager() val animations = animationManager.animations animations.forEach { animation -> println("Animation: ${animation.id}, Length: ${animation.animationLength}s") } val walkLength = animationManager.getAnimationLength("player_walk") fun playAnimationToViewers(performer: Entity, viewers: List) { animationManager.playAnimation(performer, viewers, "attack_swing") animationManager.playAnimation(performer, viewers, "attack_swing", speed = 2.0f) } fun playAnimationToNearby(performer: Entity) { animationManager.playAnimationToSelfAndNearbyPlayers(performer, "victory_dance") animationManager.playAnimationToSelfAndNearbyPlayers(performer, "victory_dance", speed = 0.5f) } fun playPreparedAnimation(performer: Entity, viewers: List) { val preparedAnim = PreparedAnimation( animationId = "spell_cast", speed = 1.5f, reverse = false ) preparedAnim.play(performer, viewers) preparedAnim.playToNearbyPlayers(performer) animationManager.playAnimation(performer, viewers, preparedAnim) animationManager.playAnimationToSelfAndNearbyPlayers(performer, preparedAnim) } ``` -------------------------------- ### Managing Texture Component Source: https://context7.com/julyss2019/jerm/llms.txt Shows how to display and dynamically update image textures within a GUI using the Texture component. ```kotlin val gui = Jerm.getGuiManager().getGui2("display-gui") val texture = gui.getComponent2("background-image", Texture::class.java) texture.texturePath = "textures/backgrounds/shop_bg.png" fun setSeasonalBackground(season: String) { texture.texturePath = "textures/backgrounds/${season}_bg.png" } ``` -------------------------------- ### Organizing with Canvas Component Source: https://context7.com/julyss2019/jerm/llms.txt Demonstrates using the Canvas component to group and manage child UI elements, including accessing nested components and cloning the entire layout. ```kotlin val gui = Jerm.getGuiManager().getGui2("complex-gui") val canvas = gui.getComponent2("header-section", Canvas::class.java) val titleLabel = canvas.getComponent2("title", Label::class.java) titleLabel.setTexts("Header Title") canvas.components.forEach { component -> println("Canvas child: ${component.id}") } ``` -------------------------------- ### Handle GUI Events with Bukkit Event Listeners Source: https://context7.com/julyss2019/jerm/llms.txt Shows how to implement a Bukkit Listener to intercept GuiOpenEvent and GuiCloseEvent, allowing for custom logic based on the GUI ID. ```kotlin import com.void01.bukkit.jerm.api.common.event.GuiOpenEvent import com.void01.bukkit.jerm.api.common.event.GuiCloseEvent import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.plugin.java.JavaPlugin class GuiEventListener(private val plugin: JavaPlugin) : Listener { init { plugin.server.pluginManager.registerEvents(this, plugin) } @EventHandler fun onGuiOpen(event: GuiOpenEvent) { val player = event.jermPlayer.bukkitPlayer val guiId = event.gui.id println("${player.name} opened GUI: $guiId") when (guiId) { "shop-gui" -> player.sendMessage("Welcome to the shop!") "inventory-gui" -> player.sendMessage("Viewing your inventory") } } @EventHandler fun onGuiClose(event: GuiCloseEvent) { val player = event.jermPlayer.bukkitPlayer val guiId = event.gui.id println("${player.name} closed GUI: $guiId") if (guiId == "settings-gui") { savePlayerSettings(player) } } private fun savePlayerSettings(player: org.bukkit.entity.Player) {} } ``` -------------------------------- ### Managing GUIs with GuiManager Source: https://context7.com/julyss2019/jerm/llms.txt Covers GUI retrieval, existence checks, file saving, progress bar creation, and sending HUD messages to players using the GuiManager interface. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.component.Texture import org.bukkit.entity.Player val guiManager = Jerm.getGuiManager() // Check if a GUI exists val exists: Boolean = guiManager.existsGui("my-shop-gui") // Get GUI by ID val guiOrNull = guiManager.getGui2OrNull("my-shop-gui") val gui = guiManager.getGui2("my-shop-gui") // List all registered GUIs val allGuis = guiManager.getGuis() allGuis.forEach { gui -> println("GUI ID: ${gui.id}") } // Save a GUI file val inputStream = javaClass.getResourceAsStream("/guis/custom-gui.yml") guiManager.saveGuiFile(inputStream, "custom-gui.yml", overwrite = true) // Create progress bars fun createHealthBar(texture: Texture): Unit { val horizontalBar = guiManager.createHorizontalProgressBar(texture) horizontalBar.setProgress(0.75) val verticalBar = guiManager.createVerticalProgressBar(texture) verticalBar.setProgressSmoothly(0.5) } // Send HUD message fun sendNotification(player: Player) { guiManager.sendHudMessage(player, "notification-anchor", "Welcome to the server!") } ``` -------------------------------- ### Implement CheckBox Component Source: https://context7.com/julyss2019/jerm/llms.txt Covers setting the initial state of a CheckBox and registering listeners to react to toggle changes. ```kotlin val checkbox = gui.getComponent2("enable-notifications", CheckBox::class.java) checkbox.isChecked = true checkbox.onCheckedChangeListener = object : CheckBox.OnCheckedChangeListener { override fun onCheckedChanged(isChecked: Boolean) { println("Notifications status: $isChecked") } } ``` -------------------------------- ### Manage Player State with JermPlayerManager Source: https://context7.com/julyss2019/jerm/llms.txt Shows how to retrieve JermPlayer instances from Bukkit players or names and use them within event listeners to manage GUI interactions. ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerJoinEvent val playerManager = Jerm.getPlayerManager() fun getJermPlayer(bukkitPlayer: Player) { val jermPlayer = playerManager.getJermPlayer(bukkitPlayer) val player = jermPlayer.bukkitPlayer println("Managing GUI state for: ${player.name}") } fun getJermPlayerByName(playerName: String) { val jermPlayer = playerManager.getJermPlayer(playerName) println("Found player: ${jermPlayer.bukkitPlayer.name}") } class GuiListener : Listener { @EventHandler fun onPlayerJoin(event: PlayerJoinEvent) { val jermPlayer = Jerm.getPlayerManager().getJermPlayer(event.player) val gui = Jerm.getGuiManager().getGui2("welcome-gui").clone() gui.openAsGui(jermPlayer) } } ``` -------------------------------- ### ComponentGroup Management Source: https://context7.com/julyss2019/jerm/llms.txt Methods for accessing, adding, removing, and navigating through GUI components using IDs or dot-notation paths. ```APIDOC ## ComponentGroup Management ### Description Manipulate individual components within a GUI, including nested components accessed via path strings. ### Method N/A (Kotlin API) ### Endpoint com.void01.bukkit.jerm.api.common.gui.ComponentGroup ### Parameters #### Path Parameters - **path** (String) - Required - Dot-notation path to the component (e.g., "container.header.title"). ### Request Example val label = gui.getComponentByPath2("container.header.title", Label::class.java) ### Response #### Success Response (200) - **component** (Component) - The requested component instance or null if not found. ``` -------------------------------- ### JermPlayer - Player GUI Tracking Source: https://context7.com/julyss2019/jerm/llms.txt Represents a player with GUI state tracking, allowing access to currently open GUIs. ```APIDOC ## JermPlayer - Player GUI Tracking The JermPlayer interface represents a player with GUI state tracking, allowing access to currently open GUIs. ### Usage ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import org.bukkit.entity.Player fun managePlayerGuis(player: Player) { val jermPlayer = Jerm.getPlayerManager().getJermPlayer(player) // Get all currently open GUIs for this player val openGuis = jermPlayer.getUsingGuis() println("Player has ${openGuis.size} GUIs open") // Get specific GUI by ID (returns null if not open) val shopGui = jermPlayer.getUsingGuiOrNull("shop-gui") shopGui?.let { println("Shop GUI is open") } // Get specific GUI by ID (throws if not open) try { val inventoryGui = jermPlayer.getUsingGui("inventory-gui") inventoryGui.close() } catch (e: Exception) { println("Inventory GUI is not open") } // Access Bukkit player val bukkitPlayer = jermPlayer.bukkitPlayer bukkitPlayer.sendMessage("Your GUI state has been checked!") } ``` ``` -------------------------------- ### Manage Label Component Text Source: https://context7.com/julyss2019/jerm/llms.txt Shows how to update Label component text dynamically, including adding lines, clearing content, and formatting multi-line strings. ```kotlin val label = gui.getComponent2("info-label", Label::class.java) label.setTexts("Line 1", "Line 2", "Line 3") label.addText("Additional information") fun updatePlayerStats(coins: Int, level: Int) { label.setTexts("Player Stats", "Coins: $coins", "Level: $level") } ``` -------------------------------- ### ProgressBar Extension Component Source: https://context7.com/julyss2019/jerm/llms.txt Provides animated progress display with customizable orientation and easing functions. ```APIDOC ## ProgressBar Extension Component The ProgressBar extension provides animated progress display with customizable orientation and easing functions. ### Usage ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import com.void01.bukkit.jerm.api.common.gui.component.Texture import com.void01.bukkit.jerm.api.common.gui.extension.component.ProgressBar val gui = Jerm.getGuiManager().getGui2("game-gui") val guiManager = Jerm.getGuiManager() // Get texture component to use as progress bar base val healthBarTexture = gui.getComponent2("health-bar-texture", Texture::class.java) // Create horizontal progress bar val healthBar = guiManager.createHorizontalProgressBar(healthBarTexture) healthBar.orientation = ProgressBar.Orientation.HORIZONTAL // Create vertical progress bar val manaBarTexture = gui.getComponent2("mana-bar-texture", Texture::class.java) val manaBar = guiManager.createVerticalProgressBar(manaBarTexture) manaBar.orientation = ProgressBar.Orientation.VERTICAL // Set progress immediately (0.0 to 1.0) healthBar.setProgress(0.8) // 80% health // Set progress with smooth animation manaBar.setProgressSmoothly(0.5) // Animate to 50% // Configure animation easing healthBar.animationEaseFunction = object : ProgressBar.AnimationEaseFunction { override fun calculate(originalProgress: Double): Double { // Custom easing (e.g., ease-out) return 1 - (1 - originalProgress) * (1 - originalProgress) } } // Configure animation duration based on progress change healthBar.animationDurationFunction = object : ProgressBar.AnimationDurationFunction { override fun calculate(deltaProgress: Double): Double { // Duration proportional to change amount (in seconds) return deltaProgress * 0.5 } } // Configure size limits healthBar.maxWidth = "200" healthBar.maxHeight = "20" healthBar.maxEndU = 200 healthBar.maxEndV = 20 ``` ``` -------------------------------- ### Utilizing ScrollBox Component Source: https://context7.com/julyss2019/jerm/llms.txt Explains how to access scroll bars and child components within a ScrollBox container for scrollable GUI layouts. ```kotlin val gui = Jerm.getGuiManager().getGui2("list-gui") val scrollBox = gui.getComponent2("item-list-scroll", ScrollBox::class.java) val vScrollBar = scrollBox.verticalScrollBar vScrollBar?.let { println("Vertical scroll bar ID: ${it.scrollBox.id}") } val itemsInScroll = scrollBox.components println("Items in scroll box: ${itemsInScroll.size}") ``` -------------------------------- ### Input Component API Source: https://context7.com/julyss2019/jerm/llms.txt The Input component provides text or number input fields with configurable sync behavior. ```APIDOC ## Input Component ### Description Provides text or number input fields with configurable sync behavior and character limits. ### Properties - `type`: Input.Type.TEXT or Input.Type.NUMBER - `maxLength`: Integer limit for characters - `isSync`: Boolean to sync input with server - `value`: Current string value of the input ### Request Example ```kotlin nameInput.type = Input.Type.TEXT nameInput.maxLength = 16 nameInput.isSync = true ``` ``` -------------------------------- ### JermPlayerManager - Player State Management Source: https://context7.com/julyss2019/jerm/llms.txt Provides access to JermPlayer instances that track player GUI state and interactions. ```APIDOC ## JermPlayerManager - Player State Management The JermPlayerManager interface provides access to JermPlayer instances that track player GUI state and interactions. ### Usage ```kotlin import com.void01.bukkit.jerm.api.common.Jerm import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerJoinEvent val playerManager = Jerm.getPlayerManager() // Get JermPlayer by Bukkit Player fun getJermPlayer(bukkitPlayer: Player) { val jermPlayer = playerManager.getJermPlayer(bukkitPlayer) // Access underlying Bukkit player val player = jermPlayer.bukkitPlayer println("Managing GUI state for: ${player.name}") } // Get JermPlayer by name fun getJermPlayerByName(playerName: String) { val jermPlayer = playerManager.getJermPlayer(playerName) println("Found player: ${jermPlayer.bukkitPlayer.name}") } // Example listener using JermPlayer class GuiListener : Listener { @EventHandler fun onPlayerJoin(event: PlayerJoinEvent) { val jermPlayer = Jerm.getPlayerManager().getJermPlayer(event.player) val gui = Jerm.getGuiManager().getGui2("welcome-gui").clone() gui.openAsGui(jermPlayer) } } ``` ``` -------------------------------- ### Component Base Interface Source: https://context7.com/julyss2019/jerm/llms.txt The Component interface is the foundation for all GUI elements in Jerm, providing access to identification, state toggling, and interaction listeners. ```APIDOC ## Component Base Interface ### Description The Component interface provides common functionality for all GUI elements, including identification, tooltips, state management (enabled/disabled), and click handling. ### Method N/A (Interface Implementation) ### Endpoint com.void01.bukkit.jerm.api.common.gui.component.Component ### Parameters #### Properties - **id** (String) - Unique identifier for the component. - **tooltips** (List) - List of strings displayed when hovering over the component. - **isEnabled** (Boolean) - Current state of the component. ### Request Example // Accessing a component from a GUI val component = gui.getComponent2("button-1", Button::class.java) component.tooltips = listOf("Click to purchase") component.enable() ### Response #### Success Response - **onClick** (Function) - Triggered on component interaction. - **getPseudoComponent** (Method) - Access sub-elements within the component. ``` -------------------------------- ### Label Component API Source: https://context7.com/julyss2019/jerm/llms.txt The Label component is used for displaying static or dynamic text content in the GUI. ```APIDOC ## Label Component ### Description Displays text content that can be dynamically updated with single or multiple lines. ### Methods - `setTexts(vararg texts: String)`: Sets multiple lines of text. - `addText(text: String)`: Appends a single line of text. - `clearTexts()`: Clears all text content. ### Request Example ```kotlin label.setTexts("Player Stats", "Coins: 100", "Level: 5") ``` ``` -------------------------------- ### Button Component API Source: https://context7.com/julyss2019/jerm/llms.txt The Button component allows for clickable UI elements with custom textures, text, and click event handling. ```APIDOC ## Button Component ### Description Represents a clickable button with configurable textures, hover states, and multi-line text content. ### Methods - `setTexts(vararg texts: String)`: Sets multiple lines of text. - `clearTexts()`: Clears all text content. - `onClickListener`: Interface for handling LEFT, RIGHT, and MIDDLE click events, including shift-click support. ### Request Example ```kotlin buyButton.texturePath = "textures/buttons/buy_normal.png" buyButton.setTexts("Buy Item", "Price: 100 coins") ``` ``` -------------------------------- ### CheckBox Component API Source: https://context7.com/julyss2019/jerm/llms.txt The CheckBox component provides a toggleable boolean control. ```APIDOC ## CheckBox Component ### Description Provides a toggleable boolean control with state change notifications. ### Properties - `isChecked`: Boolean representing the current toggle state. ### Methods - `onCheckedChangeListener`: Interface to listen for state changes. ### Request Example ```kotlin checkbox.isChecked = true checkbox.onCheckedChangeListener = object : CheckBox.OnCheckedChangeListener { ... } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.