Prerequisites
Before creating plugins, you should understand:- Basic Python programming
- How the YSFlight network protocol works (see Packet System)
- The packet types available in
lib/PacketManager/packets
Creating Your First Plugin
Create the Plugin File
Create a new Python file in the The filename will be used as the plugin name when loaded.
plugins/ directory:Add the ENABLED Flag
Every plugin must have an
ENABLED flag. This allows you to disable plugins without deleting them:Create the Plugin Class
Every plugin needs a The
Plugin class with an __init__() and register() method:register() method is where you hook into events and register commands.Register a Command
Let’s add a simple command that responds to
/hello:The
help_text parameter automatically adds your command to the /help menuAdding a Hook
Let’s extend the plugin to monitor when players send chat messages:Understanding Hook Return Values
Complete Example Plugin
Here’s a complete working plugin that counts chat messages:Next Steps
Plugin Structure
Learn about plugin file structure and best practices
Real Examples
Study complete plugins like radar and chat filter