- Joined
- Dec 22, 2013
- Messages
- 55
- Reaction score
- 0
This is the error im getting when i launch the server:
And this is my code for my AbstractScriptManager:
I'm not really sure what the issue is at this point so i anyone could tell me
- in a possibily noob friendly way then I'm all ears xD!
FWI!
I'm using XiuzSource
And this is my code for my AbstractScriptManager:
Code:
package net.sf.odinms.scripting;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.script.*;
import net.sf.odinms.client.MapleClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jdk.nashorn.api.scripting.NashornScriptEngine;
public abstract class AbstractScriptManager {
private boolean nashorn = true;
private ScriptEngineFactory sef;
protected static final Logger log = LoggerFactory.getLogger(AbstractScriptManager.class);
protected AbstractScriptManager() {
sef = new ScriptEngineManager().getEngineByName("javascript").getFactory();
}
protected NashornScriptEngine getScriptEngine(String path) {
path = "scripts/" + path;
File scriptFile = new File(path);
if (!scriptFile.exists()) {
return null;
}
NashornScriptEngine engine = (NashornScriptEngine) sef.getScriptEngine();
try (FileReader fr = new FileReader(scriptFile)) {
if (nashorn == true){
engine.eval("load('nashorn:mozilla_compat.js');" + System.lineSeparator());
}
engine.eval(fr);
} catch (final ScriptException | IOException t) {
log.error("Error executing script.", t);
return null;
}
return engine;
}
protected NashornScriptEngine getScriptEngine(String path, MapleClient c) {
NashornScriptEngine engine = (NashornScriptEngine) c.getScriptEngine("scripts/" + path);
if (engine == null) {
engine = getScriptEngine(path);
c.setScriptEngine(path, engine);
}
return engine;
}
protected void resetContext(String path, MapleClient c) {
c.removeScriptEngine("scripts/" + path);
}
}
I'm not really sure what the issue is at this point so i anyone could tell me
- in a possibily noob friendly way then I'm all ears xD!
FWI!
I'm using XiuzSource
Attachments
You must be registered for see attachments list