PyDevTools
The python developers best companion
Warning
This plugin allows any user with the correct permissions to execute potentially unsafe code, and has access to every bukkit API method, as well as the java and python standard libraries, with the same filesystem access permissions bukkit has. It is therefore inherently dangerous to use, as it enables you to irreversibly damage your bukkit installation. If you don't trust someone, or he doesn't know what he's doing, don't give him access to this plugin. Be thrice as careful if you use it on a live server.
Features
- Execute arbitrary python code from console or ingame (handle with care!)
- Execute saved python scripts (3 sample scripts included)
- Save python code as macros, save macros to disc as scripts, bind macros/scripts to items to quickly execute them via rightclick
- Interactive interpreter mode
- SQLite database connector (requires sqlitejdbc) for testing, developing, or quick and dirty database administration
- All executed python code executes in the same persistent namespace, so your declared variables will all stay in scope between statements. At the moment the namespace is shared between all users executing code via PyDevTools, so there is potential to annoy other developers if you are doing stuff at the same time :)
Dependencies
- Python Loader up and running (tested with 0.3.2)
- This modded Python Loader 0.3.2 jar, overwrite the original one (for information on what the mod does, see the Documentation)
Installation
- extract archive to your /plugins folder
Usage
Available global variables
- server
- current server instance
- bukkit
- namespace org.bukkit
- self
- sender of the code to execute, ConsoleSender or Player instance
- plugin
- the PyDevTools plugin instance (which also has the database connector, accessible via plugin.db.connect("db_file_path.db"), plugin.db.sql(sql_statement), plugin.db.query(sql_statement), the latter returns a recordset
- traceback,sys,random,os
- already imported python modules
- File
- already imported java.io.File
Commands
- /py statement
- /py name
- /py statement...
- Executes a statement or macro/script, three following dots to enter multiline statements
- /pymacro name statement
- Saves a statement as a macro
- /py save macro_name filename
- Saves a macro as a script
- /py reload
- Reloads scripts from filesystem
- /py
- Enters interactive mode
- bind macro_name
- Binds a macro to a tool to be activated via rightclick, experimental
For more information see Commands
Permissions
- pydev.execute
- main permission for almost every command, also available as OP
Examples
can be found on the Example page
Tutorials for Python Plugin Development
Here you can find tutorials to help you get started with writing python plugins
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
Will this plugin be updated any time soon? I really want to start using python to code plugins but I don't know if the code in the tutorial works for every python loader or just this one.
@roblabla
I have found the problem : line 310
replace with :
Same at line 315.
This plugin is incompatible with LWC and Lockette. When this plugin is installed with LWC/Lockette, I can open locked chest. LWC still sends a message saying the chest is locked, but doesn't cancel the opening of the chest.
I use the official PythonPluginLoader 0.3.3 (which I believe is the same as your modded one ?).
This is awesome. I will love you forever if you keep doing this (and maybe donate! :) )
You are really good at this :D