Nashorn Console 1.0.1

Use A JavaScript REPL in Minecraft

  1. ArchdukeLiamus
    Tested Minecraft Versions:
    • 1.12
    Archduke's Nashorn Console
    Run JavaScript commands within Minecraft, using the full power of Java's integrated JavaScript engine. Use JavaScript to invoke the Spigot API, whether for debugging or experimentation (or trolling :p).

    Capture.PNG

    Installation
    Easy, just drop into the plugins folder, and then optionally modify config.yml.

    Permissions
    archnashorn.invocation - Use /invoke to evaluate a JavaScript expression. Does not default to OPs, for reasons I'll explain later.

    Commands
    /invoke <JS...> - Execute a JavaScript expression. End your line with a space and backslash (" \") to continue onto the next line with subsequent uses of this command. Aliased to />.

    I would recommend having knowledge about JavaScript, the Nashorn JS engine, Java and the Spigot API to make the best use of this plugin. Take a look at these links:

    Running Java from Nashorn - https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/api.html
    Using Java from Scripts - https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/javascript.html
    JS reference - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
    Spigot API (1.12) - https://hub.spigotmc.org/javadocs/spigot/overview-summary.html


    Disclaimer
    The /invoke command does not by default give permission to OPs. This is because the command is very powerful, and can run any arbitrary code on the server, including code that may ban players, modify permissions, change blocks, create entities, overwrite files, create network connections, or crash the server. Do not give /invoke permission to anyone on your server that you don't have absolute, complete trust in!
    If you do want to allow OPs to use /invoke, change allowOps in config.yml to true. No restart is required.

    Slightly advanced notes
    Declared variables in global scope persist for as long as the server is online.
    The result of an expression is written in "> gray"
    Text written to standard out is written in white.
    Text written to standard error is written in red.
    Exceptions thrown by Nashorn or Java are written in red.
    Developers who modify the code (and you can decompile it if you want) may replace Nashorn with any other JSR-223 compliant ScriptEngine.
    The plugin will disable itself if it can't load the JavaScript script engine.

    At least Java 8 is required.
    There should be no dependencies on any specific version of Spigot, so it should be version-agnostic.

    (the source code isn't here because I have yet to get it hosted somewhere. In the meanwhile you can decompile the plugin.)


Recent Updates

  1. The startup update