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. :)
@Intangir This is great for people that don't know java though, but it may not be as great for people who know java.
I forked Python Plugin Loader and changed it a lot. I removed decorator api. Now it is only Class API. To write a plugin with this api is almost identical to writing one in java, so much so that you can safely use the documentation on how to write a java plugin; simply translate it into python. One of the new feature is to [re]load/unload plugins without server restarting
Just take a look http://dev.bukkit.org/bukkit-plugins/pploader/ Soon i will give some nice plugins (fishing plugin, chat plugin, time rangs) writte in python
gdude claims to have fixed it
i haven't tested it yet https://github.com/gdude2002/Python-Plugin-Loader
im thinking of migrating away from python scripts anyway though.. i mean it seemed like a good idea but i just end up having to debug twice as long because i don't get any of the compile time error checks
also it seems to frequently send the wrong events to the wrong handlers
The latest bukkit version breaks this plugin! (see https://github.com/masteroftime/Python-Plugin-Loader/issues/15)
how can you save persistent data across sessions? like in a config.yml doc or something
im using the decorator version of the scripts
@sat481
See this: https://forums.bukkit.org/threads/placing-iron-doors-via-plugin.118520/. If it doesn't work, try consulting the forums or the IRC channel, it sounds like more of a general Bukkit issue versus solely PythonLoader.
This is driving me mad now. I am trying to place a door in a house that is built with the command /buildhouse. The house builds fine, with a gap for the door, but when I try and place a door in the gap I only get the bottom half. I have tried adding another WOODEN_DOOR block to the top, but then I get two door items. He is a snippet of my code that places the actual door relative to the player:
block = blocks.getRelative(3,0,0)
block.setType(bukkit.Material.WOODEN_DOOR)
I have the same problem with beds also, I know it is something to do with the them been multiblock items but nothing I have tried has worked, so any help much appreciated.
Sat
@HungryBehr
I've raised this issue on GitHub, maybe if you could also weigh in there things could be done faster.
https://github.com/masteroftime/Python-Plugin-Loader/issues/14
EDIT: I fixed this, here (there's no plugin DL there, as is the bukkitdev rules). I don't feel like it's a very ideal fix, so I didn't submit a pull request, and won't be releasing a public version of my fix - but if you want a copy of it despite your better judgement, PM me.
@Brixishuge
Can confirm, it's a pretty irritating issue.
I have been downgrading to older versions of CB to troubleshoot (as a work around), but hopefully someone will come up with a way to fix the loader.
Since 1.7.2, errors are messed up and don't say anything useful...
Hello, I'm having some issues with trying to use configuration files with Python/Bukkit. I put the following files into a pyp zip file (called configtest.pyp, if that matters):
When I try and load the plugin and have it save the default configuration file, I get:
09:15:01 [SEVERE] Error occurred while enabling ConfigTest v0.1 (Is it up to date?): zip file closed java.lang.IllegalStateException: zip file closed at java.util.zip.ZipFile.ensureOpen(ZipFile.java:632) at java.util.zip.ZipFile.getEntry(ZipFile.java:303) at net.lahwran.bukkit.jython.PluginPythonZip.getStream(PluginPythonZip.java:43) at net.lahwran.bukkit.jython.PythonPlugin.getResource(PythonPlugin.java:331) at net.lahwran.bukkit.jython.PythonPlugin.saveResource(PythonPlugin.java:346) at net.lahwran.bukkit.jython.PythonPlugin.saveDefaultConfig(PythonPlugin.java:397) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:186) at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:204) at org.python.core.PyObject.call(PyObject.java:387) at org.python.core.PyObject.call(PyObject.java:391) at org.python.core.PyMethod.call(PyMethod.java:109) at org.python.pycode._pyx68.onEnable$2(<iostream>:7) at org.python.pycode._pyx68.call_function(<iostream>) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyBaseCode.call(PyBaseCode.java:301) at org.python.core.PyBaseCode.call(PyBaseCode.java:194) at org.python.core.PyFunction.call(PyFunction.java:387) at org.python.core.PyMethod.instancemethod_call(PyMethod.java:220) at org.python.core.PyMethod.call(PyMethod.java:211) at org.python.core.PyMethod.call(PyMethod.java:201) at org.python.core.PyMethod.call(PyMethod.java:196) at org.python.core.PyObject._jcallexc(PyObject.java:3502) at org.python.core.PyObject._jcall(PyObject.java:3534) at org.python.proxies.main$ConfigClass$4.onEnable(Unknown Source) at net.lahwran.bukkit.jython.PythonPlugin.setEnabled(PythonPlugin.java:163) at org.python.proxies.main$ConfigClass$4.setEnabled(Unknown Source) at net.lahwran.bukkit.jython.PythonPluginLoader.enablePlugin(PythonPluginLoader.java:388) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381) at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:284) at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:266) at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:315) at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:292) at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:252) at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:152) at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393) at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
Any ideas?
And thanks to masteroftime for a fantastic plugin!
Tim
import math < you never use it, also you should stick to importing everything before the server is running, as the importing can take time (not good for a running server)
Nice Plugin!
hello!
i run a server and have taken an intrest in writing plugins and came to this. I followed the instructions on the tutorial series to part 2, but when i try to run it it comes up with this:
12:04:10 [SEVERE] Could not load 'plugins/First.py.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException java.lang.ClassNotFoundException plugin.py
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.java:239)
at org.bukkit.craftbukkit.v1_6_R3.CraftServer.<init>(CraftServer.java:217)
at net.minecraft.server.v1_6_R3.PlayerList.<init>(PlayerList.java:56)
at net.minecraft.server.v1_6_R3.DedicatedPlayerList.<init>(SourceFile:11)
at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:107)
at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
Caused by: java.lang.ClassNotFoundException plugin.py
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
... 9 more
12:04:10 [INFO] [PythonLoader] Loading PythonLoader v0.3.4
I dont know what is wrong. my file setout is:
craftbukkit/lib/jython.jar jythonstandalone.jar
craftbukkit/plugins/First/plugin.yml plugin.py
craftbukkit/plugins/PyPluginLoader.jar
My YML is this:
name: plugin
main: plugin.py
version: 0.1
My PY is this
import org.bukkit as bukkit
server = bukkit.Bukkit.getServer()
@hook.enable
def onEnable():
print "SimpleDemoPlugin enabled!"
@hook.disable
def onDisable():
print "SimpleDemoPlugin disabled!"
If someone has a solution it would really help. Thanks!
Oh, and in the .py the @hook.x does not show in any solour.
Thanks
FIXED
Wrong directory name
@MrBB4
If you are using the Decorator API over the Class API, I believe there never really is an instance where you need to use separate/main classes. Classes are just another way you can right the plugins for the loader to use. The only time where you cannot use the Decorator API (to my knowledge) is when you are using the Bukkit Task Scheduler. In this instance, it appears you have to use the class method.
@MrBB4
Thanks, I was struggling with the same issue and your comment really helped me out.
Hi guys. I'm stuck at the end of part one of the second tutorial by @zaph34r. I'm getting this error when calling bukkit.entity:
The error occures at line 87 of this script from the tutorial. Inside the onRoulette function. That is the original code shown in the tutorial.
I'm guessing the problem is some misspell in the src. I'm using version 0.3.4. Any body knows what's going on?
EDIT: Ok, so I've found the problem. Aparently when bukkit gets imported it doest import all of its component. You can fix this by importing the missing parts, in my case I had to add import org.bukkit.event to my code. By the way, just importing it as from org.bukkit import * doesn't work, so you'll have to manually import every component that you need ( that's not imported automatically).
@masteroftime if you are still developing this plugin, maybe this could be added modified to work aumatically :)
I've got another cuestion actually. What use does it have the main class of a plugin? so far haven't seen a reason to use it. Maybe I'm not getting something.
i really like this plugin, ive made a dozen tweaks to my server, and it only takes a dozen or so lines instead of writing a big precompiled java thing.. with a dozen files and huge java tools..
@Intangir
You can reload after making changes and see them, but to my knowledge there is no way to reload just one plugin.
@yurippenet
Sorry, I should have been more clear. I still have the reload issue from time to time, I was mainly addressing your point regarding compatibility with the newest versions of CraftBukkit (they work).
Also, thanks for the info on the YAML stuff. I will give it a shot.