Steve's Series | Gui Library
0.0.0-mc1.18.2The most advanced (or at least I think) GUI management library.
> Gui Library <
THIS PLUGIN REQUIRES Steve's Series | Kotlin
The most (or at least one of) advanced GUI management library. Unlike other GUI libraries, SS-GuiLibrary supports any kind of GUI, in addition to inventory GUIs, while not currently supported by the library itself, it is entirely possible to create a kind of GUI that would use books instead, as an example. SS-GuiLibrary uses Kotlin for most of it's functions, while it is possible to use it from Java, I highly recommend Kotlin as there are a lot of things with this plugin that would not be as clean of solutions in Java as they can be in Kotlin. The most powerful part of this library is the GuiComponents with their state management.
There are multiple ways in which you can create a chest GUI with this library:
- Using InventoryGuiController (I do not know any cases in which you would want to use this, unless building a custom solution):
class TestGui : InventoryGuiController() { override fun createInventory() = this.player.server.createInventory(null, 9, "Test GUI") override fun update() { val stack = ItemStack(Material.EMERALD_BLOCK) val meta = stack.itemMeta meta.setDisplayName("Test") stack.itemMeta = meta this.inventory.setItem(0, stack) } override fun onClick(event: InventoryClickEvent) { event.isCancelled = true if (event.clickedInventory != this.inventory || event.click == ClickType.DOUBLE_CLICK) { return } if (event.click.isLeftClick && event.slot == 0) { this.player.sendMessage("Hello, world!") } } override fun onDrag(event: InventoryDragEvent) { event.isCancelled = true } } - Using GridInventoryGui (best for simple GUIs):
class TestGui : GridInventoryGui() { override fun getSize() = GridInventorySize.GENERIC_9X1 override fun getTitle() = "Test GUI" override fun render(canvas: ItemCanvas) { canvas.item(0, 0) { stack { type = Material.EMERALD_BLOCK } meta<ItemMeta> { setDisplayName("Test") } leftClick { _, _, _, _ -> [email protected]("Hello, world!") } } } } - Using ComponentGui and GuiComponents (best solution, but less performant than the previous two):
class TestGui : GuiComponent(), RootComponent { override fun getSize() = GridInventorySize.GENERIC_9X1 override fun getTitle() = "Test GUI" override fun ComponentCanvas.render() { item(0, 0) { stack { type = Material.EMERALD_BLOCK } meta<ItemMeta> { setDisplayName("Test") } leftClick { _, _, _, _ -> [email protected]("Hello, world!") } } } }
Here's a more advanced example of the GuiComponents:
class PlayerInfoComponent(
private val player: Player
) : GuiComponent() {
private fun getMaxHealth() =
[email protected](Attribute.GENERIC_MAX_HEALTH)?.value
override fun ComponentCanvas.render() {
val playerName = [email protected] // The name of a player cannot change, no need to watch it.
val playerHealth = watch { [email protected] }
val playerMaxHealth = watch { [email protected]() }
item(0, 0) {
stack { type = Material.PLAYER_HEAD }
meta<SkullMeta> {
setDisplayName("${ChatColor.WHITE}$playerName")
lore = listOf(
"",
"${ChatColor.GRAY}Health: ${ChatColor.YELLOW}$playerHealth/${ChatColor.YELLOW}$playerMaxHealth"
)
}
}
}
}
class SelfInfoComponent : GuiComponent(), RootComponent {
override fun getSize() = GridInventorySize.HOPPER
override fun getTitle() = "Your Player Info"
override fun ComponentCanvas.render() {
val player = [email protected]
component(2, 0, 1, 1, PlayerInfoComponent(player))
}
}
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta