- Joined
- Nov 14, 2008
- Messages
- 1,016
- Reaction score
- 629
With the release of Java 8 comes the new nashorn script engine that replaces the old deprecated piece of garbage that is Rhino. It is orders of magnitude faster and will benefit you in your journey. If you haven't already updated to Java 8, then what the **** are you waiting for? We get lambdas, the new awesome date API, the collection stream API, etc. This is the great Java update in a while
now if you do update to Java 8, you'll see that the whole source collapses upon starting and trying to load event scripts, and a good amount of npc scripts. That's because importPackage was removed and you need to import mozilla_compat.js from nashorn. Now i'm not going to add that one line of code to all the damn scripts, it would be annoying.
this is for moopledev but I don't think the shitty script interface from odinms was ever touched again so you should be good with this rls
go to AbstractScriptManager
under
replace old **** with
notice how I use the great collection's stream to my advantage; look how elegant that code is
now you can get all the benefits of Java 8 without touching your code
if you wish to know the list of awesome changes that were included in Java 8, this may be of interest
now if you do update to Java 8, you'll see that the whole source collapses upon starting and trying to load event scripts, and a good amount of npc scripts. That's because importPackage was removed and you need to import mozilla_compat.js from nashorn. Now i'm not going to add that one line of code to all the damn scripts, it would be annoying.
this is for moopledev but I don't think the shitty script interface from odinms was ever touched again so you should be good with this rls
go to AbstractScriptManager
under
PHP:
if (c != null) {
c.setScriptEngine(path, engine);
}
replace old **** with
PHP:
try (Stream<String> stream = Files.lines(scriptFile.toPath())) {
String lines = "load('nashorn:mozilla_compat.js');";
lines += stream.collect(Collectors.joining(System.lineSeparator()));
engine.eval(lines);
} catch (final ScriptException | IOException t) {
if (ServerConstants.VPS)
FilePrinter.printError(FilePrinter.INVOCABLE + path.substring(12, path.length()), t, path);
else
System.out.println(t);
return null;
}
notice how I use the great collection's stream to my advantage; look how elegant that code is
now you can get all the benefits of Java 8 without touching your code

if you wish to know the list of awesome changes that were included in Java 8, this may be of interest
To view the content, you need to sign in or register
Last edited:

