API reference

Everything the runtime binds into your scripts. All of it is available as a global, with no import.

Core

Article Covers
Script Script.loadClass, unload callbacks, runtime libraries, profiling hooks
$ magic imports The shorthand Java class resolver
Modules: import and export Sharing code between scripts, path resolution, reload cascades
Bukkit The Bukkit server global and the platform helpers around it

Reacting to the server

Article Covers
Commands registerCommand, tab completion, aliases, middleware
Event listeners registerListener and event priorities
Scheduler Sync and async tasks, timers, cancellation
Concurrency model What runs on which thread, and why loading blocks

Data and the outside world

Article Covers
Database The Sql module, queries and transactions
HTTP fetch Calling external APIs
Console logging log, warn, error
JSON Parsing and serializing
Shared state and messaging StaticStorage, GlobalMap, GlobalNotification, DataFile
Implementing Java interfaces Handing a JavaScript implementation back to a Java plugin

The two you should read first

If you only read two articles here, make them Modules and the concurrency model. Between them they account for most of the bugs people hit in their first month.


Table of contents