RedstoneTorch

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

RedstoneTorch is a basic wrapper that allows interfacing between Mozilla's Rhino script engine and Bukkit, allowing users to create Javascript scripts to hook onto events in their server.

Most of that was PROBABLY gobbly-de-gook to most of you, so I'll explain a bit more:

I've noticed recently that there's a lack of innovation in my server amongst my staff. They reason, they say, is because they don't want to burden our developers with more jobs than they need to have, or they simply don't know Java in order to create a custom modification to the server, or they don't know how to compile a plugin.

I used to work for a number of WoW servers running under ArcEmu in the past and, some of you may know, it embedded Lua into it to allow people to script Lua and still create innovative scripts that run on the server to provide events, ai scripting, and even world battlegrounds, just from this one simple language.. and that's where RedstoneTorch comes in.

RedstoneTorch lessens the gap between Minecraft and normal staff by enabling the use of JavaScript, powered by Mozilla's Rhino scripting engine, to interface with Java. This allows any member of staff to create a script for the server with ease, providing they know JavaScript. The reason I chose JavaScript is simple:

  • It is dynamically typed - no variable type definitions.
  • It is a simple language to follow.
  • It is already configured to interface with Java through the JavaAdapter class.

RedstoneTorch currently supports [limited] callback events. Script creators can write a function to be called when something happens within the server. These are powered by Bukkit Events. Whenever a Bukkit Event happens (PLAYER_LOGIN, for example), all functions that have been registered to activate on that event will be called and passed appropriate parameters. So, how do you register a callback?

var Logger = java.util.logging.Logger.getLogger("Minecraft"); // get the default output. this will probably be set as a global variable in the future
function onPlayerLogin(event, player, result) {
   // here you could prevent the player from logging in by doing event.setCancelled(true).
   // the incredible thing is that you can invoke any method on any of the parameters that you would be able to in java.
   if(player.getName() == "Neglected") {
      Logger.info("Neglected is uber pro [psst he just logged on]."); // print to the console.
   } else {
      event.setCancelled(true); // prevent anyone else logging on.
   }
}

// All events are set as global identifiers in the environment. You can see all these identifiers in the usage.txt in the plugin zip folder.
EventMgr.register(PLAYER_LOGIN, onPlayerLogin); // registers the event to fire when the player logs in.

It really is that simple. You will soon be able to hook onto any event imaginable (including custom events), so the customization possibilities will be near endless!


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files