changed plugin back to __plugin

This commit is contained in:
walterhiggins 2013-01-25 00:53:40 +00:00
parent 9f7b19379b
commit a002e1100c
3 changed files with 2 additions and 3 deletions

View file

@ -95,7 +95,7 @@ addition to the functions provided in the MCP version of ScriptCraft,
there are a couple of useful Java objects exposed via javascript in there are a couple of useful Java objects exposed via javascript in
the Bukkit ScriptCraft plugin... the Bukkit ScriptCraft plugin...
* `plugin` - the ScriptCraft Plugin itself. This is a useful starting point for accessing other Bukkit objects. The `plugin` object is of type [org.bukkit.plugin.java.JavaPlugin][api] and all of its properties and methods are accessible. For example... `js plugin.getServer().getMotd()` returns the server's message of the day. * `__plugin` - the ScriptCraft Plugin itself. This is a useful starting point for accessing other Bukkit objects. The `__plugin` object is of type [org.bukkit.plugin.java.JavaPlugin][api] and all of its properties and methods are accessible. For example... `js __plugin.server.motd` returns the server's message of the day (javascript is more concise than the equivalent java code: __plugin.getServer().getMotd() ).
* `self` - The player/command-block or server console operator who invoked the js command. Again, this is a good jumping off point for diving into the Bukkit API. * `self` - The player/command-block or server console operator who invoked the js command. Again, this is a good jumping off point for diving into the Bukkit API.
* `bukkit` - The top-level Bukkit object. See the [Bukkit API docs][bukapi] for reference. * `bukkit` - The top-level Bukkit object. See the [Bukkit API docs][bukapi] for reference.

View file

@ -95,7 +95,7 @@ public class ScriptCraftPlugin extends JavaPlugin
File boot = new File(JS_PLUGINS_DIR + "/core/_scriptcraft.js"); File boot = new File(JS_PLUGINS_DIR + "/core/_scriptcraft.js");
this.engine = factory.getEngineByName("JavaScript"); this.engine = factory.getEngineByName("JavaScript");
this.engine.put("__engine",engine); this.engine.put("__engine",engine);
this.engine.put("plugin",this); this.engine.put("__plugin",this);
this.engine.put("__script",boot.getCanonicalPath().replaceAll("\\\\","/")); this.engine.put("__script",boot.getCanonicalPath().replaceAll("\\\\","/"));
this.engine.eval(new FileReader(boot)); this.engine.eval(new FileReader(boot));
}catch(Exception e){ }catch(Exception e){

View file

@ -24,7 +24,6 @@ var verbose = verbose || false;
wph 20130124 - make self, plugin and bukkit public - these are far more useful now that tab-complete works. wph 20130124 - make self, plugin and bukkit public - these are far more useful now that tab-complete works.
*/ */
var bukkit = org.bukkit.Bukkit; var bukkit = org.bukkit.Bukkit;
var __plugin = plugin;
// //
// private implementation // private implementation
// //