Skip to content

Kotlin API Overview ​

The plugin world defines calls between a plugin and the server. The WIT source directory contains the interface definitions.

DirectionKotlin APIPlugin code
Exports: server calls into the pluginPumpkinPlugin callbacks and PluginMetadataExtend PumpkinPlugin, configure pumpkin.pluginClass, and override the callbacks you need.
Imports: plugin calls into the serverGenerated types under pumpkin.*, such as Context.Context, Inventory.Inventory, and World.WorldCall the generated bindings directly.

The callback reference maps exports to Kotlin methods. The interface map lists generated namespaces.

Callback registration ​

The Gradle plugin uses pumpkin.pluginClass to instantiate your PumpkinPlugin subclass. The API implements the WIT exports, including lifecycle and metadata calls.

Use events, commands, tasks, ipc, aiGoals, and chunkGenerators to register callbacks. The API assigns handler IDs and dispatches calls. events.listen(...) returns an EventSubscription with unregister(); task methods return a ScheduledTask with cancel().

You can still override PumpkinPlugin methods for direct WIT handling. Generated resource calls such as inventory.getItem(slot) need no callback registration.

Generated bindings ​

Kotlin helpers manage callbacks; generated bindings carry the server data. For example, Event.Event is the event variant, Command.ConsumedArgs holds parsed arguments, Inventory.Inventory operates on slots, and World.ChunkBuffer is the generation resource.

The API version determines the bundled WIT bindings. The plugin and server must use compatible WIT contracts; an operation in the bindings may be absent from an older server. IDE completion shows the members in the selected release.

Released under the MIT License.