Jycraft / jycraft

Extend Minecraft servers with Python using Jython.
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

File execution #22

Closed AngelMunoz closed 8 years ago

AngelMunoz commented 8 years ago

Added file execution support with plugin context (canary, spigot, sponge) the python files must be in the minecraft's server directory or under to be able to run

server |---- plugins |---- logs |---- script.py L--- jycraft-plugins ------ script.py (or)

and sent over json in a string like this (No Leading slash):

ws.send('{"type":"file", "filePath":"script.py"}');

or

ws.send('{"type":"file", "filePath":"jycraft-plugins/script.py"}');

the above is useful when editing python files from the web-based editor and sending the location for live execution,

Also, added the posibility to load python files from the server's start server |---- plugins |---- logs |---- script.py |--- jycraft-plugins L--- python-plugins ------ <any amount of .py files here>

execfiles

the above screenshot was obtained with a script like this

from org.bukkit import Bukkit

SERVER  = Bukkit.getServer()
WORLD   = SERVER.getWorlds().get(0)

print(WORLD, SERVER)
print("HELLO")

asuming that you have plugins that already work you can just load them from the start with the new changes.