documentation/Modded PythonLoader
PythonLoader Mod
Most tutorial projects i made use the modded PythonLoader version i made. It adds a few features to the original PythonLoader, and should be compatible with any plugins made for the official version.
Features
- 2 additional decorators,
@EventHandler
and@CommandHandler
- both can do the same as
@hook.event
and@hook.command
, but are enhanced for usage with classes. - You can decorate bound (instance) methods, staticmethods and classmethods with them, provided the class inherits
PythonPlugin
orListener
- both
PythonLoader
andListener
are available by default without any imports - In addition to normal usage you can also use
@EventHandler
without specifying an event type, and it will try to infer it from the function name. For an eventorg.bukkit.event.category.SomeNameEvent
the function can be called eitherSomeName
oronSomeName
, it will automatically work outcategory
- For now, all instances with decorated handlers need to be instantiated before
onEnable
(so normally in__init__
), after thathook
freezes handler registration
Source
The source is available at the github page of the fork i created
Comments