What Can Plugins Do?
Plugins in Sakuya AC can:- Hook into Events: Intercept and modify flight data, chat messages, join/unjoin events, and more
- Add Commands: Register custom chat commands that players can use
- Modify Packets: Change, block, or inject network packets between client and server
- Implement Game Mechanics: Add features like damage systems, radar, chat filtering, and more
Plugin Architecture
The plugin system is managed by thePluginManager class located in lib/plugin_manager.py. It automatically discovers and loads plugins from the plugins/ directory.
Key Components
Plugin Discovery
Plugin Discovery
The PluginManager scans the
plugins/ directory for:- Python files (
.py) that are not private (__) - Subdirectories with
__init__.pyfiles
- An
ENABLEDflag set toTrue - A
Pluginclass with aregister()method
Hook System
Hook System
Hooks allow plugins to intercept events and data. When triggered:
- Callbacks receive the data and can inspect/modify it
- Returning
Falseblocks the original data from being forwarded - Returning
Trueallows the data to continue normally
Command System
Command System
Plugins can register chat commands that players trigger with
/commandname:- Commands receive the full message, player object, and message queues
- Can send responses to client or forward modified messages to server
- Support aliases and help text for automatic
/helpgeneration
Available Hooks
The following hooks are available in the plugin system:| Hook Name | Description | Use Case |
|---|---|---|
on_flight_data | Triggered when flight data is received from client | Monitor aircraft state, enforce limits |
on_flight_data_server | Triggered when flight data is sent to clients | Modify position data, implement radar |
on_chat | Triggered when chat message is received | Filter content, log messages |
on_join_request | Triggered when player requests to join | Validate joins, setup player data |
on_unjoin | Triggered when player leaves | Cleanup player data |
on_remove_airplane_server | Triggered when aircraft removal packet sent | Modify death behavior |
Plugin Loading Process
Plugins are loaded at server startup. Changes to plugins require a server restart to take effect.
Example Use Cases
Over-G Damage
Monitor aircraft G-forces and apply damage when limits are exceeded
Radar System
Hide enemy aircraft positions based on IFF and distance
Chat Filter
Moderate inappropriate language in chat messages
Custom Commands
Add server commands like
/refuel, /weather, /teleportNext Steps
Get Started
Create your first plugin in minutes