Skip to content
Tad Hardesty edited this page Jun 16, 2014 · 1 revision

Directory

During development, plugin code can be placed in a directory with a name ending in .py in the plugins directory. This directory should contain all the code and resources, including a plugin.yml which matches the normal Bukkit plugin.yml for Java plugins in most cases. The name, version, and main fields are mandatory.

The main field should be in the format module:classname, where module is the name of the Python module (usually the filename) to import and classname is the name of the class in the module. For example, if your code is in a file named myplugin.py and your main class is named MyPluginMain, your main should be myplugin:MyPluginMain. The :classname portion is optional, and if it is omitted then it is autodetected instead. The names Main, Plugin, and quick (see Quick Module) are checked for existence, and the first one found is used.

Example for main class Plugin in file pluginmain.py:

name: PluginName
version: 1.0
main: pluginmain

For advanced users, the value named by classname can actually be a class extending PythonPlugin, an instance of such a class, or an object with a _make_plugin attribute which will be called to create the plugin (this is how quick is implemented).

Zip package (Coming soon)

Plugins will be able to be packaged into zip files with extension .pyp. The structure of the zip should match that of the Directory type above.

Single file

Simple plugins can also be saved as a single file with extension .py. This script is treated as the main script to load for the plugin. For specifying plugin.yml information, a comment can be included at the top of the file before any code:

# ---
# name: PluginName
# version: 1.0
# author: Example Man
# ---

Blank lines or other comments can be placed before the first --- or after the second one, but the full plugin.yml contents must precede any code. If main is included, it acts like the second half of main described in the Directory type above, and autodetects similarly if it is excluded. The main module is always the single file.

The name and version properties will be filled in automatically if they are omitted (such as if no comment is present).

Clone this wiki locally