mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 21:59:05 +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
+1
-1
@@ -5,7 +5,7 @@ plugins {
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
version = "1.10-testingbeta18.7"
|
||||
version = "1.10-testingbeta18.8"
|
||||
group= "kamkeel.customnpc-plus"
|
||||
archivesBaseName = "CustomNPC-Plus"
|
||||
|
||||
|
||||
@@ -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