Python Plugin Loader
PythonLoader 0.3.4
This plugin allows developers to code bukkit plugins in the python programming language. The plugins in python can either use a thin wrapper to the standard Bukkit API, or the newer decorator API. For more detailed instructions for installing this plugin and how to code plugins, take a look into the Readme on Github.
Features:
- Load bukkit plugins written in python.
Installation: Put PythonLoader.jar into plugins directory and jython.jar into lib directory (within bukkit folder not plugins folder).
Downloads:
- PythonLoader 0.3.4
- Jython (By downloading and using Jython you accept the Jython License)
- Source Code
Documentation
The Readme on github contains an introduction to creating plugins in python
Also make sure to check out @zaph34r's tutorial series
I have to give special credits to lahwran who created the whole decorator API and corrected many of my mistakes. :)
Hey guys!
I finally made an update! The firs new thing is tab completion. You can now register a tab completer function by setting it in the @CommandHandler decorator. Here's an example
The tabCompleter can have the same signatures as command handlers and has to return a list of strings or a single string as possible completions. If the handler returns None the argument is completed based on the players which are online.
The second new feature is that Jython is automatically downloaded if it is missing.
I hope you'll enjoy it!
This plugin is awesome, thanks a lot for making it! It really helped me to get into the plugin mechanics!
About updates
As the loader only depends on the plugin system of bukkit it is very unlikely to break when a new bukkit version comes out. So just try if it still works with new bukkit versions and if it doesn't feel free to contact me via PM. I don't always have time to test when bukkit is updated.
Can you update the plugin to the latest version (1.3.2 - R2.0)?
@masteroftime
Nice job :) If we are looking java, python rocks. By the way, python always rocks ;)
This made me so happy you have no Idea....
EDIT: Well except the memory leak but I can deal with that.
@getpsimon
The cause of this error is a special kind of memory leak. Here's a good article about this problem http:frankkieviet.blogspot.ca/2006/10/classloader-leaks-dreaded-permgen-space.html
I don't know if the leak lies in the plugin loader or if it is a problem with your plugin. You can try to increase the PermGenSpace size with -XX:MaxPermSize=128M but I think that this will just delay the error.
Another solution I found was -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled however I have no idea if this will work.
Any word on when support for 1.3 will be coming around? ( I know it's not an RB yet, but just curious)
- Most Useful plugin ever :)
When I reload the server at the console about every third reload will the cause the server to crash. See the error log snip at pastebin. What do you thinks? This started happening after I installed my first attempt of a plugin.
Log Error at pastebin
Is there a method for reading NBT files to access offline player data? If so, could somebody please post an example? Thanks.
When I try to load my config file like this:
@hook.enable def onEnable(): myconfig = pyplugin.getConfig()
it gives me the error:
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: File cannot be null
In java, that error happens when you try to load the config file before the onEnable event; but this is not the case here; what am I doing wrong?
Guys, i need some help with mysql driver in jython. Could you paste some working example of mysql connetion?
Great plugin :D
As a python programmer i have strong aversion to java :) great job!
For some reason I can use events but if I try to use the player.PlayerPreLoginEvent It dosen't work at all . I have tried it with the @hook.event and the @EventHandler and the problem with the latest craftbukkit build and plugin version .
@N0T0R10US try here
http://dev.bukkit.org/server-mods/pydevtools/pages/tutorials/
or here
https://github.com/masteroftime/Python-Plugin-Loader/blob/master/readme.md
@zaph34r
Thanks man :D you are always helpful :D :D !
also every thing you assumed was correct, even the frozen thingy .
Hey,
Are there any tutorials on making python plugins? (Importing stuff?) I already have knowledge of python... but I just don't know how to get started.
Thanks, N0T0R10US
@Malcolm2608
Am i correct in assuming that you are instantiating a class that has an bound event handler after the plugin is created and initialized? The handlers all have to be registered/instantiated before onEnable (so in __init__ or something). From the looks of it you are doing it in onEnable, which is too late :)
I'm not sure if that behaviour could be changed, but as it is now the hook doesn't accept any registrations after the plugin instance is created (the mentioned 'frozen' state) which is before onEnable is called.
@masteroftime
When Ever I try to create an event that way I get this error :
Traceback (most recent call last):
File "<iostream>", line 160, in onEnable
File "<iostream>", line 15, in call
File "<iostream>", line 48, in register
error: Cannot register handlers when frozen
I tried googling it but I cant figure it out :/
@zaph34r
Thanks you very much, you are right the error was from a other line of code. It works now.