https://github.com/sya-ri/ktinventory
Spigot library with Kotlin for easy inventory creation and event handling
https://github.com/sya-ri/ktinventory
kotlin kotlin-library minecraft minecraft-plugin paper paper-plugin spigot spigot-plugin
Last synced: about 1 year ago
JSON representation
Spigot library with Kotlin for easy inventory creation and event handling
- Host: GitHub
- URL: https://github.com/sya-ri/ktinventory
- Owner: sya-ri
- License: apache-2.0
- Created: 2022-10-02T05:50:31.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-23T19:41:28.000Z (about 1 year ago)
- Last Synced: 2025-06-02T10:50:31.311Z (about 1 year ago)
- Topics: kotlin, kotlin-library, minecraft, minecraft-plugin, paper, paper-plugin, spigot, spigot-plugin
- Language: Kotlin
- Homepage: https://gh.s7a.dev/ktInventory
- Size: 432 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ktInventory
[](http://kotlinlang.org)
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://search.maven.org/artifact/dev.s7a/ktInventory)
[](https://gh.s7a.dev/ktInventory)
[](.github/workflows/build.yml)
Spigot library with Kotlin for easy inventory creation and event handling
## Installation
### build.gradle.kts
```kotlin
repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("dev.s7a:ktInventory:2.0.0-SNAPSHOT")
}
```
## Usage
```kotlin
class SimpleMenu(
plugin: Plugin,
) : KtInventory(plugin, 1) {
override fun title() = "&0&lSelect where to teleport"
init {
button(3, ItemStack(Material.RED_BED)) { event, _ ->
val player = event.whoClicked as? Player ?: return@button
val respawnLocation = player.respawnLocation
if (respawnLocation != null) {
player.teleport(respawnLocation)
} else {
player.sendMessage("Not found respawnLocation")
}
player.closeInventory()
}
button(5, ItemStack(Material.COMPASS)) { event, _ ->
val player = event.whoClicked as? Player ?: return@button
player.teleport(player.world.spawnLocation)
player.closeInventory()
}
}
}
```