This page as Markdown: https://bloxd.io/docs/how-to-plugins.md. Every page of these docs, for AI agents: https://bloxd.io/docs/llms.txt
Plugins
First-party plugins provide reusable World Code features. Import a plugin from @plugins/<name> in your entry file or another project file:
import { setTimeout, getRandomItem } from "@plugins/helpers"
import { debugLog } from "@plugins/debug"
Importing a plugin also loads its callbacks. Plugin callbacks run before callbacks with the same name in your own code, so both of these tick callbacks run:
import { setTimeout } from "@plugins/helpers"
tick = () => {
/* Your tick code */
}
If callbacks return a value, your callback's return value takes precedence over the plugin's. Avoid replacing a useful plugin return by accident, particularly in callbacks such as onPlayerChat and onRespawnRequest.
Plugins may import other plugins. Their dependencies are loaded automatically, so importing @plugins/sessionBasedGame also loads the helpers it needs.
Available plugins
@plugins/helpersexportssetTimeout,setInterval,clearTimeout,clearInterval,forceLoadChunk,randomInt,shuffleArray, andgetRandomItem.@plugins/dialogueexportssayDialogue, which shows a player a line of dialogue for a while, andclearDialogue. See Dialogue.@plugins/debugexportsdebugLog.@plugins/sessionBasedGameprovides a lobby-to-game lifecycle, teams, spectators, map loading, optional map voting, optional team choosing, and automatic game resets.
The editor's autocomplete and the read-only plugin source files are the reference for the latest exports and option types.