Home›Java›Mods›SpigotJS
ModsJava

SpigotJS

Java mod listed for Minecraft 1.9. Download on the author's site.

⬇ Download on Spigot
A simple plugin that uses Nashorn to execute JavaScript code on your server.

Currently only dedicated functions for event and command handling have been added however if the community shows interest then the list of features will also expand.

Automated Reloading

spigot-js utilises Java's WatchService to automatically load scripts when they are created, scripts will also automatically be reloaded when changes are made as well as unloaded when the script file is deleted.

Event Handling

Code (Text):
manager.on(events.PlayerJoinEvent, function(event) {
    plugin.getLogger().info(event.getPlayer().getName() + " has joined");
});
The events object contains the FQNs of all bukkit events, though you can also use a FQN as a string as the first parameter in the on function.

Command Handling

Code (Text):
manager.command("greet", function(sender, args) {
    sender.sendMessage("Hello " + sender.getName());
});
Here is an example of registering a command. Nashorn automatically maps the function to the corresponding functional interface enabling code that feels like regular JavaScript.

Plugin Integration

If anyone wishes for me to add specific plugin integration then please let me know via the issues page on the github repository and when I get the time I will see what I can do.
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

SpigotJS is a free Minecraft Java mod. Compatible with Minecraft 1.9. Downloaded 182 times (via Spigot). Download it and open it directly in the game.

Explore more