The plugin is feature complete, but I will keep updating it, if you experience any issues or bugs feel free to join my Discord Server and choose the role "minecraft player"
The plugin relies on Nashorn and thanks to
JSEngine it was really easy to make the plugin Compatible with
anyJava version above 8.
OpenJavaScript is a powerful Minecraft plugin designed to integrate JavaScript scripting into your Minecraft server. This plugin allows server administrators and developers to write and execute JavaScript code directly, enabling dynamic and customizable server behaviors without needing to recompile or restart the server.
With
OpenJavaScript, you can basically make your own plugin for your server quickly, however there are a few limitations which you need to consider:
- The scripts need to be written in
JavaScript and not in Java - You can listen to Events and cancel them, however its a bit different than in
Java(I'd recommend to take a look at the documentation) - It is possible that when reloading the plugin too often, memory leaks can develop but this is unconfirmed
Its basically Skript but in JavaScript
To create a script/javascript file you simply go inside the plugins script folder
(plugins/OpenJS/scripts), then make a js file, example "file.js" and put it there, then start coding (
I recommend using Notepad++) and make any script you want. Also
make sure that your script is loaded and enabled, if you don't know how to check that then take a look at the commands.
Main Command: /oj This command is used to manage JavaScript scripts within the OpenJavascript plugin.
Subcommands
Help:
Usage: /oj help
Description: Displays the usage and description of available subcommands.
Version:
Usage: /oj version
Description: Displays the version of this plugin.
Reload:
Usage: /oj reload or /oj reload <script>
Description: Reloads all scripts and the config file. If a script name is specified, reloads only that script.
Load:
Usage: /oj load <script>
Description: Loads the specified script. Made for scripts that where added to the scripts folder after the plugin got enabled by the server
Enable:
Usage: /oj enable <script>
Description: Enables and loads the specified script.
Disable:
Usage: /oj disable <script>
Description: Disables and unloads the specified script.
List:
Usage: /oj list or /oj list enabled, /oj list disabled, /oj list not_loaded
Description: Lists all scripts. Optionally, lists only enabled, disabled, or not loaded scripts.
openjs.use
Allows using all OpenJS commands
That's actually it
Features:
JavaScript Integration: Write and run JavaScript scripts to control various server functions.
Performance: Each script, including the plugin is Multithreaded, however, most of the performance rely on the scripts
Custom Event Handling: Register and handle Minecraft events using JavaScript, enabling custom responses to in-game actions.
Custom Scheduling: Create your own scheduled or delayed function, the possibilities are endless.
Ease of Use: Simple setup and straightforward API make it easy for both beginners and advanced users to create custom scripts.