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 or Listener
  • both PythonLoader and Listener 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 event org.bukkit.event.category.SomeNameEvent the function can be called either SomeName or onSomeName, it will automatically work out category
  • For now, all instances with decorated handlers need to be instantiated before onEnable (so normally in __init__), after that hook freezes handler registration

Source

The source is available at the github page of the fork i created


Comments

Posts Quoted:
Reply
Clear All Quotes