Repository navigation
Quick Module
The quick module offers features for easily defining your plugin's functions when you don't want to write an entire class extending PythonPlugin. To use quick, specify ':quick' as the main class name in your plugin.yml, or omit it for autodetection.
See Packaging Plugins for information on the comment at the top of this example.
# ---
# name: QuickExample
# commands:
# test:
# usage: /<command>
# ---
import quick
@quick.enable
def enable():
print "Hello from QuickExample enable"
@quick.event('player.PlayerJoinEvent')
def join(event):
event.player.sendMessage("Hello from QuickExample join event")
@quick.command('test')
def onCommand(sender, command, label, args):
sender.sendMessage("Hello from QuickExample command")Apply these decorators to functions with the specified signatures. Most decorations can be used multiple times, in which case the registered functions will be called in order.
enable: Called during the plugin's onEnable.
Usage: @quick.enable
Arguments: none
disable: Called during the plugin's onDisable.
Usage: @quick.disable
Arguments: none
command: Called as the onCommand handler for a specific command.
Usage: @quick.command(name)
Arguments: (sender, command, label, args)
Return: True for success, False to show usage. If None is returned, defaults to True.
event: Called to handle a given event type. Arguments match @EventHandler described in Plugin Basics.
Usage: @quick.event(event, [priority=NORMAL, ignore_cancelled=False])
Arguments: (event)
log: Call with any sequence of arguments to log them to the console separated by spaces.
Example: quick.log("The number of the day is", 2)
plugin: Variable representing the plugin object, for accessing configuration and more.
Example: number = quick.plugin.config.getInt("number", 2)