Njol / Skript

Skript is a Bukkit plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
http://njol.ch/projects/skript
104 stars 65 forks source link

More flexible script loading/unloading from Java #371

Open jarcode-foss opened 9 years ago

jarcode-foss commented 9 years ago

(I don't write skript myself, I'm simply writing a plugin hook to support skript creation)

Using java, there's currently no real nice way to call script loading/unloading, other than using ScriptLoader.loadScripts(File folder) and unloadScripts(...) from the same class. There's a few issues with this:

I have resorted to using reflection to call script loading and unloading on single files, but I feel like this is a very poor solution that may break given any skript developers choose to change anything in ScriptLoader.

Mirreski commented 9 years ago

There's currently no one working on the current version of Skript(As far as I know).

Well Destroyer is making a new Skript, developing it from scratch. So the code will change completely. But it will take a long while before that's out I think.

You can load or unload single files without resorting to reflection. Since you said you were not using Skript, I can say that there's a command /skript (reload|enable|disable) <_script_>.

https://github.com/Njol/Skript/blob/master/src/main/java/ch/njol/skript/SkriptCommand.java Check out the getScriptFromArgs method and the onCommand.

ScriptLoader.loadScripts(File folder) is restricted to folders yes. But there's also ScriptLoader.loadScripts(final File[] files) which is for specific scripts.

Your other statements I agree with.

jarcode-foss commented 9 years ago

Thanks for showing me those other methods. I don't know how I missed them.

I'm happy to help out on that other version of skript, there is a lot of stuff in here that warrants a re-write. Is there a link to the repository?

Mirreski commented 9 years ago

No problem:P

The repository is here: https://github.com/w00tmast3r/Skript

Check out the branches(parser and variables) for code since the master branch doesn't have any code.

I don't know how much he has done other than the code there(Last updated 16 days ago) or if he wants any help.

A working version will perhaps/probably take a while.

jarcode-foss commented 9 years ago

Oh, that looks very... primitive. I would have to wait until he has the parser for skript done, at least. I don't think jumping in and making pull requests when he's in the middle of writing a parser would be the best idea.

I'm looking at getting Skript integration into my Consoles project/plugin, it has a text editor that I think would be nice to support writing with Skript in addition to the current Lua programs.