Getting Started
Kite is plugin that provides a Kotlin scripting runtime for Paper-based Minecraft servers. It is designed for small and simple tasks and serves as a much more powerful alternative to Skript and other scripting plugins.
| High Performance Scripts are compiled to achieve near-native performance. | |
| Folia Support Scripting runtime is compatible with Folia. This includes wrappers for Folia schedulers. | |
| Command Registration Register commands effortlessly with a single function. | |
| Event Listening Listen to Bukkit, Spigot, Paper, or even custom plugin events. | |
| Access Everything Full access to Bukkit API, built-in libraries and loaded plugins. | |
| Script Organization Split scripts into multiple files or keep it simple with one file per script. |
Installation
Follow these installation steps to get started with Kite.
Requirements
- Paper based server running 1.21.1 or higher, and Java 21.
- Understanding of Kotlin language and general JVM concepts is beneficial.
Download
- Modrinth (modrinth.com/plugin/kite)
- Hangar (hangar.papermc.io/EchoNine/Kite)
- GitHub (github.com/EchoNineLabs/Kite)
Install
Put downloaded plugin in your plugins directory and restart the server.
Create
Kite should now be up and running. Learn more about writing scripts in sections below.
Quick Start
This small guide should put you on track.
Useful Links
- Kotlin Documentation (kotlinlang.org)
Useful info for getting started with Kotlin and Kite development. - Paper Documentation (docs.papermc.io)
Useful info for getting started with Paper ecosystem. - Paper JavaDocs (jd.papermc.io)
Paper / Bukkit API reference. - Adventure JavaDocs (javadoc.io)
Adventure API reference. - Kite Discord (discord.com)
We are always happy to answer your questions.
Structure
- Scripts must end with
.kite.ktsextension. - Scripts can be stored directly inside
plugins/Kite/scriptsdirectory.
Example:plugins/Kite/scripts/my_script.kite.kts - Scripts can be stored inside sub-folders of
plugins/Kite/scriptsdirectory.
Example:plugins/Kite/scripts/my_other_script/main.kite.kts- Entry point of the script must be a file named
main.kite.kts. - Other files within the same sub-folder can be imported using top-level
@file:Importannotation.
Example:@file:Import("helpers.kite.kts")
- Entry point of the script must be a file named
- Single-file and multi-file script projects can be used at the same time.
- my_script.kite.kts
- small_script.kite.kts
- main.kite.kts
- helpers.kite.kts
This is the entry point of sub_example script.
This is an additional script that can be imported with
@file:Import("helpers.kite.kts")annotation.
This is a single-file script.
This is also a single-file script.
Lifecycle
Scripts, similarly to plugins, have onLoad and onUnload blocks that are called respectively after loading, and before unloading a script. You should really make use of them.
onLoad {
println("Hello, World!")
}onUnload {
println("Godbye, World!")
}Compilation
Kite compiles scripts to Java Bytecode and stores the result inside plugins/Kite/cache directory. It is very important to understand where to put your code in order to avoid potential resource leaks.
Top-level function calls, property and object intialization will be done right after compilation.
println("Hello from compilation!")Since compilation is asynchronous, you should avoid calling non-thread-safe functions outside of onLoad and onDisable blocks.
Example
This will result in an exception being thrown.
val targetBlock = server.getPlayer("Player").getTargetBlockExact(10)
onLoad {
println(targetBlock.type)
}onLoad {
val targetBlock = server.getPlayer("Player").getTargetBlockExact(10)
println(targetBlock.type)
}Importing
Majority of Bukkit and Paper imports can be omitted, as they are added automatically during compilation. This includes but is not limited to:
org.bukkitio.papermc.papercom.destroytokyo.papernet.kyori.adventure.text
Anything else, such as external plugin APIs, must be imported before you can reference it in coded.
import me.clip.placeholderapi.PlaceholderAPI
onLoad {
println(PlaceholderAPI.setPlaceholders(null, "%server_uptime%"))
}In case you run into a type conflict problems, see:
Reference & Examples
Learn more about provided APIs and examples on the Reference page.