- KIA needs to run on a PaperMC server, because some paper specific functions are used.
Maven
-
<repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> <dependency> <groupId>com.github.staticfx</groupId> <artifactId>kia</artifactId> <version>1.1.5</version> </dependency>
Gradle Groovy:
-
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() maven { url 'https://jitpack.io' } } } compile "com.github.staticfx:kia:1.1.5"
Gradle kts
-
repositories { maven { setUrl("https://jitpack.io") } } implementation("com.github.staticfx:kia:1.1.5")
Add this inside your plugin onEnable to use KIA
override fun onEnable() {
KIA.create(this)
}
To get a quick look on how to use KIA, please visit the wiki.
KIA is an API programed using the papermc api to make inventory management and its creation easier. Using NBT KIA is able to handle inventories without naming issues or similar.
val inventory = kInventory(sender, 5.rows, InventoryType.CHEST) {
setItem(row = 1, slot = 4, kItem(Material.DIAMOND_PICKAXE) {
setDisplayName(Component.text("Some cool item").color(TextColor.color(255, 0, 0)).decorate(TextDecoration.BOLD))
enchant(Enchantment.DIG_SPEED, 5)
})
}
setItem(1, 4, kItem(Material.DIAMOND_PICKAXE) {
onClick { kItem: KItem, player: Player -> player.sendMessage("Cool you just clicked ${kItem.slot}") }
})
openingAnimation = endlessAnimation(100, TimeUnit.MILLISECONDS) {
onAnimationFrame {
row.shift(ShiftDirection.LEFT, 1, true)
this@mainPage.setRow(1, row)
}
}
This animation will play everytime the inventory is opened.
val pageInventory = kPageInventory(sender, 5.rows) {
looping = true
title = Component.text("Paging Inventory")
mainPage {
this.title = Component.text("This is the main page")
header = defaultHeader
}
addPage {
this.title = Component.text("Page 2")
header = defaultHeader
}
addPage {
this.title = Component.text("Page 3")
header = defaultHeader
}
}
With support for page headers to make navigating an ease!
val defaultHeader = kPageController {
nextBtn = kItem(Material.PAPER, 1) {
setDisplayName(Component.text("Next Page ->"))
}
previousBtn = kItem(Material.PAPER, 1) {
setDisplayName(Component.text("<- Previous Page"))
}
placeholderItem = kItem(Material.BLACK_STAINED_GLASS_PANE, 1) {
setDisplayName(Component.text("'"))
}
builder = { nextBtn: KItem, previousBtn: KItem, placeholder: KItem -> run {
kRow {
setItem(0..1, placeholder!!)
setItem(2, previousBtn!!)
setItem(3..5, placeholder)
setItem(6, nextBtn!!)
setItem(7..8, placeholder)
}
}}
}
For more examples and on how to use KIA, please head over to the wiki!
- NBT System for Inventory Matching (Gets rid of inventory title issues)
- Different helper functions to build the inventories easier
- Optional row based system to easier build and manage your inventories