Documentation page is still under construction, and some information may be inaccurate or missing…
Getting Started

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

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

Structure

  • Scripts must end with .kite.kts extension.
  • Scripts can be stored directly inside plugins/Kite/scripts directory.
    Example: plugins/Kite/scripts/my_script.kite.kts
  • Scripts can be stored inside sub-folders of plugins/Kite/scripts directory.
    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:Import annotation.
      Example: @file:Import("helpers.kite.kts")
  • Single-file and multi-file script projects can be used at the same time.
      • my_script.kite.kts
      • This is a single-file script.

      • small_script.kite.kts
      • This is also a single-file script.

        • main.kite.kts
        • This is the entry point of sub_example script.

        • helpers.kite.kts
        • This is an additional script that can be imported with @file:Import("helpers.kite.kts") annotation.

  • 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

    Function Player#getTargetBlockExact cannot be called outside of the main thread.
    This will result in an exception being thrown.
    val targetBlock = server.getPlayer("Player").getTargetBlockExact(10)
    
    onLoad {
        println(targetBlock.type)
    }
    Instead, you should take a safe approach.
    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.bukkit
    • io.papermc.paper
    • com.destroytokyo.paper
    • net.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.