Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devsrsouza/kotlinbukkitapi

KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features Kotlin has to make your life more easier.
https://github.com/devsrsouza/kotlinbukkitapi

bukkit dsl kotlin minecraft spigot

Last synced: 5 days ago
JSON representation

KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features Kotlin has to make your life more easier.

Awesome Lists containing this project

README

        

KotlinBukkitAPI

## KotlinBukkitAPI

![Kotlin version](https://img.shields.io/static/v1?label=Kotlin&message=1.5.0&color=Orange&style=for-the-badge)
[![GitHub stars](https://img.shields.io/github/stars/DevSrSouza/KotlinBukkitAPI.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADYklEQVR4XuWbvbPNQBiHn9uo6NFT0GEYHa0/QofOR2MojI8xxmh8VFwVf4RaxTB0KOhdPRUF8zPJmdy1J3l3N9ndxDb3zr0n2exzfu/zJjk5G5Qdh5vp35c6jI1SEzfzbgK/gXOljqMkgF3A1wbAXuBHCQglAehdf9wsWr8rDdlHSQCq+0MdBxzJvnqgFADJ752zYAHILsNSABT3Mw4A/S27DEsAaOW30wHwHcguwxIAuvJzyz67DEsA6MrPBaD/ZZVhbgA++bkQssowNwCf/FwAWWWYE8A6+bkAssowJ4A++RWTYU4AffIrJsNcACzyKyLDXAAs8isiwxwArPIrIsMcAELkl12GOQCEyC+7DAUgpj5LXLpPMeemAOwAXgLHp5ih4n2+Ak62JbCnuRmhn//D2ALUmre6DlAClAQlYsnjJ3ACeK1FuhI8CzxZ8uqbu06rG7C+LrBkKf5zpekDsFQp/pUeoBJYjXXnAUuT4kp6bnn3nQgtRYrbpBcCQK9dghR7b7RaToXnLMXB22sWAHOVold6oSXQvn5uUlwrvVgA2m4uUuyVXgqAuUgx6NMliwN8t6rcDzZrOXselF5qArR9rVI0SW8MANpHbVI0S28sADVJMUh6YwKoRYpB0hsbwEHgQ2ED6hg+xR5DTBfoznUDuB47+Ujb6Rhuxu4rFcBH4EDs5CNtp3dfKYgaKQBqiH+76OgySAFQQ/xbANFlkAKghvi3AKLLIBZATfFPKoNYADXFP6kMYgHUFP+kMogBUGP8o8sgBsBY8f8MXGqO/D6wP6qRb98ouBvEAEiNvx6DuwU8BH41x69L7AvANUBPlMSO4G4QCiAl/vpqzDPgKvBtzQp3A3eB0wmP8gedFIUCiI3/G+A88Nb41h4DHgFHja93r0/M1wahAELjr3f6CvC8+W5QyHp0bEqCEqFkWEdQGYQACIm/blI8AG4DqvmUISfIDXKE9dkFcxmEALDG/wVwEfiSsmrPtvsaqKcM+zV3gxAAQ/Fv25oATDkEYKhtmsvACqAv/r62NiUA7dvSNk1lYAXgi7+lrU0Noq9tmsrACsCNf2hbmxqEr22aysACoBv/lLY2NQRf2xwsAwsARUlnb2O1talBdNvmnaEbphYA94CnE7S1qUGobeozzMt9E/0BUX274HXoySkAAAAASUVORK5CYII=)](https://github.com/DevSrSouza/KotlinBukkitAPI/stargazers)
[![Github Issues](https://img.shields.io/github/issues-raw/DevSrSouza/KotlinBukkitAPI.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAGfklEQVR4Xu2bd6glNRSHv7Vjw46KDRULCqLYFVSwIHZFFCvYKzZU7A17r6CsiqjYG4oigqIidtQ/RCzYOzbsDZUPMst9900myczc3bfuHnj/vElyzvklOTntTmIGp0kzuP7MBGDmCRg9ArMCawMbA6sCKwNLA/OFP7//BnwPfAa8C7wBvAC8BPw5ShFHdQXmALYF9gQ2B+ZvqcQvwBPAXcCDwO8t14lO6xuARYBjgEOAhXoW9jtgMnA58GVfa/cFwDzAacCRwNx9CRdZx+tyNXAu8GNXXn0AsBNwFbBUV2EK538BHA48UDhvzPAuAMwVFD+wiwA9zL05AOHJKKa2ALjbjwBrFHMczYTXge2BT0qX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KiRESjFuygzdDew2vGAMgJxiiEUQvbJS6vMVGOSdSotZPn84FwBjcBMe+v0x+iYkRb0uJTQKAFLKK+uSdSe2yae2GHlqQjPDVCO1EuobgJTyylaUEKmUcfc/AmyAaqLSq9AnAIPeYEzGn0J4rxEcR6nQMqc4YqHC3N2jmcegLwC80yZmUjmCsxtqhMnY2pY3i6OpdhiLo2ZuckDoAwDzhabuDc2bSN9/tdCJWjsudQKcJNJWYlLkSTgi42XoCsChoTstJ08oUI2bkgOAil8HyDiHNIw2TJpZ6pMs09kXYDUoh+xdtFGjkXIB8KiZDl8ztWD4rvJGalaNuzY7m52yAu1d1pPLoZdDYjfJOxcAmfqO2iS1XI4EYcynYddskirt4bNrrGqSStmgQZHeBzbK7ScuAUAmKwHmC2LNSjFs9L9tj3syBCNvh+qzT5Q2wU4UAbbeuC6wCbB+hoUf5vdV2Pn3cjepFIAKBBslS05Crjxdxrnzls+zlZdZGwCq66BfvVYXiXuc6+myTae4jb4tAMquYbwMOKxHRdospbU/vq2x7QJAJazI27+f083ZRsHYHJ0c/Y4c5yvKtw8AXFyP0Zy76WoN2ihJw+mvRuxga9UiPyhcXwBUa+qs6Hx4LXLf7FywDGl1hK7sswu1bwAqZXRetgb2ArYAFsjVcmicEZw/mroNeCz0A7Vcqn7aqAAY5GaOUQ9y8GdzOja24FR5R3/749G290gfwQBMf+O14Rxer9p3eAb7lmOarTc1TsA0Uy6H8UwAclD6P4/5D0siPlDBJvVTAAAAAElFTkSuQmCC)](https://github.com/DevSrSouza/KotlinBukkitAPI/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/DevSrSouza/KotlinBukkitAPI/master.svg?style=for-the-badge&color=orange&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAABACAYAAABP97SyAAADZElEQVRoQ+2ZSciOURTHf1+ZZdoZMpdhIUOyJGTe2CpLyRhKYYGwQUghQ1nJ3sZQhpIQGbKhEMk8LMg8Rf/PfdT3ed/nTs/z9Xi7d/Uuz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evSrSouza/KotlinBukkitAPI/commit)
[![Discord](https://img.shields.io/discord/597530273009106975?style=for-the-badge&color=ORANGE&label=Discord)](https://discord.gg/HhucBqk)
[![Minecraft Server Running with KotlinBukkitAPI](https://img.shields.io/bstats/servers/6356?color=ORANGE&style=for-the-badge)](https://bstats.org/plugin/bukkit/KotlinBukkitAPI/6356)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?color=ORANGE&style=for-the-badge)](https://choosealicense.com/licenses/mit)
[![Build Status](https://img.shields.io/jenkins/build?jobUrl=http%3A%2F%2Fjenkins.devsrsouza.com.br%2Fjob%2FKotlinBukkitAPI%2F&style=for-the-badge)](http://jenkins.devsrsouza.com.br/job/KotlinBukkitAPI/)

KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features Kotlin has to make your life more easier.

* Need help? contact me on [Twitter](https://twitter.com/DevSrSouza) or join the [Discord](https://discord.gg/HhucBqk)

## ANNOUNCEMENT

**Developer returns to the project! You can find a lot more information at [Discord](https://discord.gg/HhucBqk), join and chat with me!**

### Contents:

* [Documentation](https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/)
* [Issue reporting](https://github.com/DevSrSouza/KotlinBukkitAPI/issues)
* [Dev builds (download)](http://jenkins.devsrsouza.com.br/job/KotlinBukkitAPI/)
* [Starter project](https://github.com/KotlinMinecraft/KBAPI-StarterProject/)
* [Setup for development](https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/Getting-Started)
* [Example plugins](https://github.com/KotlinMinecraft)

# Samples

## [We have more Samples in the Documentation](https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/)

KotlinBukkitAPI goes beyond this samples, and you can find all of it in the [wiki/documentation](https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/).

Event DSL sample
```kotlin
plugin.events {
event {
player.msg("&3Welcome ${player.name}".translateColor())
}

event {
broadcast("&eThe player &c${player.name} &eleft :(".translateColor())
}
}
```

Simple Command DSL example
```kotlin
plugin.simpleCommand("twitter") {
sender.msg("&eFollow me on Twitter :D &ahttps://twitter.com/DevSrSouza".translateColor())
}
```

Item meta DSL and other stuff
```kotlin
val gem = item(Material.DIAMOND).apply {
amount = 5
meta {
displayName = "&bGem".translateColor()
}
}
val encbook = item(Material.ENCHANTED_BOOK).meta {
displayName = "&4&lThe powerful BOOK".translateColor()
addStoredEnchant(Enchantment.DAMAGE_ALL, 10, true) // putting sharpness 10 to the book
}
```

Another approach:
```
val gem = item(Material.DIAMOND, amount = 5).displayName("&bGem".translateColor())

val encbook = metadataItem(Material.ENCHANTED_BOOK) {
displayName = "&4&lThe powerful BOOK".translateColor()
addStoredEnchant(Enchantment.DAMAGE_ALL, 10, true) // putting sharpness 10 to the book
}
```

Menu creator DSL
```kotlin
val myMenu = menu(+"&cWarps", 3, true) {

val arenaPvP = item(Material.DIAMOND_SWORD) {
addEnchant(Enchantment.DAMAGE_ALL, 5, true)
displayName = "&4Arena PvP".translateColor()
}

slot(2, 4, arenaPvP) { // Line, Slot
onClick {
player.teleport(Location(player.world, 250, 70, -355))
close() // close the menu
}
}

slot(2, 6, item(Material.GOLD).displayName("&6Shop".translateColor())) {
onClick {
player.teleport(Location(player.world, 2399, 70, -1234))
close() // close the menu
}
}

// when the menu renders to a player, will show the Paper item with their name.
slot(3, 9, item(Material.PAPER).displayName("Hello {player}")) {
onRender {
showingItem?.meta {
displayName = displayName.replace("{player}", player.name)
}
}
}
}

// open to player
myMenu.openToPlayer(player)
```

You can find more examples in the [Documentation](https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/)

# Project

## Modules

![](.github/images/module-graph.svg)

| Module | Description |
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Architecture | KotlinPlugin and Lifecycle aware APIs, inspired in Android Lifecycle Components |
| Extensions | Extensions for bunch of Bukkit types like block, player, inventory, text, permissions, etc |
| Utility | Utility types and APIs for Kotlin and Bukkit development, for example, ExpiratioList, OnlinePlayerCollections, Kotlin Duration tick support. |
| Coroutines | Adds Kotlin Coroutines Dispatcher for Bukkit Scheduler API as well as adding Flow APIs and Structured Concurrency (CoroutineScope bounded to Lifecycle of the plugin or Manager class). |
| Exposed | Extensions for SQL framework [Exposed](https://github.com/JetBrains/Exposed/) |
| Serialization | Extensions for [Kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) |
| Menu | DSL to create Menus easy and support for Preview in IntelliJ by using the [Plugin](https://github.com/DevSrSouza/KotlinBukkitAPI-Tooling#menu-preview) |
| Command Legacy | DSL to create Commands and Sub Commands with Parameter type safe, auto registering and support for Coroutines |
| Scoreboard Legacy | DSL to create Scoreboard with support for handling updates easily |

## Consider donate

Buy Me A Coffee






![logo](logo.png)