mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Try Block for Nashorn Factory
This commit is contained in:
1 parent
5faebbdf6e
commit
ce4c269b6f
2 files changed
+15
-4
No files matched your search
@@ -63,9 +63,20 @@ public class ScriptController {
|
||||
return;
|
||||
LogWriter.info("Script Engines Available:");
|
||||
|
||||
ScriptEngine engine = manager.getEngineByName("nashorn");
|
||||
if (engine != null) {
|
||||
this.nashornFactory = engine.getFactory();
|
||||
try {
|
||||
this.nashornFactory = new NashornScriptEngineFactory();
|
||||
LogWriter.info("→ standalone Nashorn loaded");
|
||||
} catch (NoClassDefFoundError e) {
|
||||
// fallback to built-in (Java 8–11) — also guarded
|
||||
try {
|
||||
ScriptEngine eng = manager.getEngineByName("nashorn");
|
||||
if (eng != null) {
|
||||
this.nashornFactory = eng.getFactory();
|
||||
LogWriter.info("→ built-in Nashorn loaded");
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LogWriter.error("No Nashorn engine available");
|
||||
}
|
||||
}
|
||||
|
||||
for (ScriptEngineFactory fac : manager.getEngineFactories()) {
|
||||
|
||||
Reference in new issue
Block a user