DragonHunt3r / ChatGames

Spigot ChatGames plugin: https://www.spigotmc.org/resources/64888/
MIT License
2 stars 7 forks source link

add javascript as an engine #3

Open JusToastDEV opened 3 years ago

JusToastDEV commented 3 years ago

import com.vk2gpz.jsengine.JSEngine; ... public class Foo { void bar() { ScriptEngine engine = JSEngine.getNewEngine(); try { engine.eval("your script"); } catch (javax.script.ScriptException ex) { ex.printStackTrace(); } ... }

code for adding JSEngine as a depend, as displayed on the plugin website

https://www.spigotmc.org/resources/jsengine.92709/ thanks ;)

Steve-Tech commented 3 years ago

I'm not sure, but I think a null just needs to be added to ScriptEngineManager in ChatGames.java, like change

private final ScriptEngineManager manager = new ScriptEngineManager();

to

private final ScriptEngineManager manager = new ScriptEngineManager(null);