OwO What is dis?
Some Minecraft Plugins out there used the Nashorn JS Engine in the past to evaluate some stuff.
This Engine was removed in Java 15, which caused some problems for these plugins.
The NashornJS Plugin provides a ScriptEngineManager to create new script engines.
How does it work?
NashornJS registers a ScriptEngineManager as a service on load.
You can use this service to retrieve your own nashorn engine instance.
That's all. Now you can use your nashorn instance like you always did.
You won't need any external dependency for this way, which was a main point for this implementation.
You may want to add NashornJs as a Softdepend in your plugin.yml
Of course there may be a better way, but the Bukkit Classloader is fucking around with everything, so I will stick with this easy any reliable way.
If you know a better way please contribute to the git repository.
What is this cli thingy OwO?
This plugin has also a small cli to use javascript on your server.
It is disabled by default for obvious reasons.
JS in the wrong hands, and the trouble can start.
You can use the cli with the /js or /nashorn command.
Write a \ at the end to add another line.
Every player can have its own engine instance.
You will need the nashorn.eval permission to access the cli.
Some Minecraft Plugins out there used the Nashorn JS Engine in the past to evaluate some stuff.
This Engine was removed in Java 15, which caused some problems for these plugins.
The NashornJS Plugin provides a ScriptEngineManager to create new script engines.
How does it work?
NashornJS registers a ScriptEngineManager as a service on load.
You can use this service to retrieve your own nashorn engine instance.
Code (Java):
var reg
= Bukkit.
getServer
(
).
getServicesManager
(
).
getRegistration
(ScriptEngineManager.
class
)
;
var managerChan = reg. getProvider ( ) ;
var nashornChan = managerChan. getEngineByName ( "nashorn" ) ;
var managerChan = reg. getProvider ( ) ;
var nashornChan = managerChan. getEngineByName ( "nashorn" ) ;
You won't need any external dependency for this way, which was a main point for this implementation.
You may want to add NashornJs as a Softdepend in your plugin.yml
Of course there may be a better way, but the Bukkit Classloader is fucking around with everything, so I will stick with this easy any reliable way.
If you know a better way please contribute to the git repository.
What is this cli thingy OwO?
This plugin has also a small cli to use javascript on your server.
It is disabled by default for obvious reasons.
JS in the wrong hands, and the trouble can start.
You can use the cli with the /js or /nashorn command.
Write a \ at the end to add another line.
Every player can have its own engine instance.
You will need the nashorn.eval permission to access the cli.
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.13, 1.14, 1.15
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
NashornJs - Provider and CLI is a free Minecraft Java mod. Compatible with Minecraft 1.13, 1.14, 1.15, 1.16 and newer. Downloaded 2,018 times (via Spigot). Download it and open it directly in the game.