Plugin Tutorial
This tutorial assumes that you are familiar with the python programming language. If you aren't you should first read some tutorials teaching Python and then return to this tutorial.
Here's a link to the python tutorial on the official Python Homepage.
A python plugin file (.pyp) is a ZIP archive file and it has to contain at least two files: 'plugin.py' and 'plugin.yml'.
The plugin.py file is interpreted once when your plugin is loaded. The plugin.yml file contains information about your plugin such as the plugin name, the main class and plugin version.
Every Plugin has to contain a main class which extends PythonPlugin and is located in the plugin.py file. You need to define two methods in this class 'onEnable(self)' and 'onDisable(self)'. These methods are called whenever your plugin is enabled and disabled, usually when the Bukkit server is starting up and shutting down.
from org.bukkit.plugin.python import PythonPlugin // import PythonPlugin. Very important!
def MyPlugin(PythonPlugin):
def onEnable(self):
print "My Plugin has been enabled"
def onDisable(self):
print "My Plugin has been disabled"