Jycraft / jycraft

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

File execution #21

Closed AngelMunoz closed 8 years ago

AngelMunoz commented 8 years ago

Added file execution support 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"}');
AngelMunoz commented 8 years ago

I will add another change before pulling

pauleveritt commented 8 years ago

I’m not sure I understand this…you say the file must be stored on the server to be run, but you then show sending it from the client.

—Paul

On Jan 12, 2016, at 5:47 AM, Angel Daniel Munoz Gonzalez notifications@github.com wrote:

Added file execution support 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:

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

ws.send('{"type":"file", "filePath":"jython-plugins/script.py"}'); You can view, comment on, or merge this pull request online at:

https://github.com/Jycraft/jycraft/pull/21 https://github.com/Jycraft/jycraft/pull/21 Commit Summary

added preliminary file execution support added preliminary file execution support reduced amount of times exception in time adapter ocurs to one per log message File Changes

M src-canary/jycraft/plugin/canary/MainPlugin.java https://github.com/Jycraft/jycraft/pull/21/files#diff-0 (16) M src-common/jycraft/plugin/JyCraftPlugin.java https://github.com/Jycraft/jycraft/pull/21/files#diff-1 (3) A src-common/jycraft/plugin/impl/FileRunnable.java https://github.com/Jycraft/jycraft/pull/21/files#diff-2 (56) M src-common/jycraft/plugin/json/Message.java https://github.com/Jycraft/jycraft/pull/21/files#diff-3 (12) M src-common/jycraft/plugin/servers/PySFListener.java https://github.com/Jycraft/jycraft/pull/21/files#diff-4 (48) M src-spigot/jycraft/plugin/spigot/MainPlugin.java https://github.com/Jycraft/jycraft/pull/21/files#diff-5 (14) M src-sponge/jycraft/plugin/sponge/SpongePlugin.java https://github.com/Jycraft/jycraft/pull/21/files#diff-6 (8) Patch Links:

https://github.com/Jycraft/jycraft/pull/21.patch https://github.com/Jycraft/jycraft/pull/21.patch https://github.com/Jycraft/jycraft/pull/21.diff https://github.com/Jycraft/jycraft/pull/21.diff — Reply to this email directly or view it on GitHub https://github.com/Jycraft/jycraft/pull/21.

AngelMunoz commented 8 years ago

yes, both things work check pull request #22 if you want yo execute let's say working plugins written in python you can leave them at the "serversroot/python-plugins/" directory and they will be loaded automatically after the websocket server starts, however if you are developing scripts and want to test them as soon you make changes, you can send them for live execution over json, I emailed you being a bit more specific in the last case