[INACTIVE][DEV] ScriptInjector v0.15 - Execute java code in on the fly [617]

Discussion in 'Inactive/Unsupported Plugins' started by Edward Hand, Mar 31, 2011.

  1. Offline

    Edward Hand

    version: v0.15
    There are many times in plugin development and testing when you just want to run a quick function or lookup a variable and don't want to have to write/rewrite a plugin to do it. This plugin allows you to do just that easily and quickly (and a lot more besides).
    The Basics
    When this plugin loads, a new window will pop up alongside the server console. This is the script injection window.
    In this window you can type in any java code, and when you press [return] it will be interpreted and run.
    Functions and variables can be defined and called within the interpreter and will be stored in memory until the plugin is disabled.
    Anything you can do under normal circumstances within a plugin can be done inside the interpreter.
    In order that you be able to call functions within the server, one variable comes pre-defined for you and that is plugin.

    Plugin refers to the running instance of the ScriptInjector plugin. Use it as you would a reference to your main JavaPlugin class in your own plugins.

    Example (open)
    //Notch has logged in! Quick let's set him on fire!

    [I][B][FONT=arial black][FONT=trebuchet ms]Applications[/FONT][/FONT][/B][/I]
    • Exploration - Answer questions like "I wonder what that function does" and "what happens if I change this variable?" Useful for investigating the obfuscated server source at the very least.
    • Testing - Got a quick idea you want to test? Try it out.
    • Debugging - Look up the value of any variable (even private ones) just by typing a reference to it in the interpreter or call any function. Debug without changing a single line of code.
    • Fun - Make spur-of-the-moment temporary 'plugins' on the fly, for fun, on your server.
    More Features

    Script files + Predefined Functions (open)
    The file "ScriptInjector/startup.java" contains code that is run when the plugin is enabled. In there I have defined a number of functions that may be useful. You may add to this file yourself.

    You can also create your own files of java code and load them in at any time with:
    (defined in startup.java)
    Command Access (open)
    Java code can also be run from chat using:
    /eval [put the code you want to run here]
    Anything returned by the code will be posted back to you in chat. Functions/variables defined in the Interpreter Window can be called in chat and visa versa.

    commandAccess.eval permission is required.

    Multi threading (open)
    By default, all code is run on the minecraft main thread. If you want code to be executed in a thread on its own (eg for monitoring variables at regular intervals) you can turn on threading with:


    (which is defined in startup.java). All subsequent code execution will be run on its own thread.

    Integrate with your plugins easily (open)
    The plugin variable comes predefined to point to the ScriptInjector plugin but can easily be changed to point at your own plugin with:
    (defined in startup.java)

    Or you can build the link into your plugin code by calling the setPlugin(Plugin p) function in the ScriptInjector main class.

    Download now

    Copy everything in the zip file to your plugins directory.
    Feature Summary
    • Execute java code on the fly either from a console or through chat

    • Plugin released
    • Plugin will now allow /eval to work even if the script window cant initialise (eg when running on command-line-only servers).
    DPOH-VAR, wizjany, matter123 and 2 others like this.
  2. Offline

    Edward Hand

Share This Page