PyDevTools

3.2k Downloads

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

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