Overview
Pumpkin features a powerful, async-first plugin system that allows you to extend the server with custom functionality. Plugins can:- Listen and respond to game events
- Register custom commands
- Manage permissions
- Share services between plugins
- Load dynamically at runtime
Plugin Architecture
The plugin system is built around several core concepts:Plugin Trait
All plugins implement thePlugin trait, which provides lifecycle hooks for initialization and cleanup.
Context
Each plugin receives aContext object that provides access to:
- Server instance
- Event registration
- Command registration
- Permission management
- Service registry
- Data folder for persistent storage
Event System
Plugins can register event handlers to respond to game events like player actions, block changes, and server events. The event system supports:- Blocking and non-blocking handlers
- Priority-based execution order
- Cancellable events
Plugin API Version
The current plugin API version is:Plugin Types
Pumpkin supports multiple plugin types through its loader system:- Native Plugins: Rust-based plugins compiled as dynamic libraries
- Custom Loaders: Plugins can register custom loaders for other languages (Lua, JavaScript, etc.)
Plugin Directory
Plugins are loaded from the./plugins directory. Each plugin gets its own data folder at ./plugins/{plugin_name}/ for storing configuration and persistent data.
Plugin Metadata
Every plugin must provide metadata:Plugin States
Plugins go through several states during their lifecycle:Loading- Plugin is being initializedLoaded- Plugin loaded successfully and is activeFailed(String)- Plugin failed to load with error message
Next Steps
- Getting Started - Create your first plugin
- Lifecycle Hooks - Learn about plugin lifecycle
- Event System - Work with events and handlers
