diff --git a/README.md b/README.md index 980a725..f0dd1fa 100644 --- a/README.md +++ b/README.md @@ -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 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. * `bukkit` - The top-level Bukkit object. See the [Bukkit API docs][bukapi] for reference. diff --git a/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java b/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java index 46245f0..5185be4 100644 --- a/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java +++ b/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java @@ -95,7 +95,7 @@ public class ScriptCraftPlugin extends JavaPlugin File boot = new File(JS_PLUGINS_DIR + "/core/_scriptcraft.js"); this.engine = factory.getEngineByName("JavaScript"); this.engine.put("__engine",engine); - this.engine.put("plugin",this); + this.engine.put("__plugin",this); this.engine.put("__script",boot.getCanonicalPath().replaceAll("\\\\","/")); this.engine.eval(new FileReader(boot)); }catch(Exception e){ diff --git a/src/main/javascript/core/_scriptcraft.js b/src/main/javascript/core/_scriptcraft.js index 16afa51..cc4273e 100644 --- a/src/main/javascript/core/_scriptcraft.js +++ b/src/main/javascript/core/_scriptcraft.js @@ -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. */ var bukkit = org.bukkit.Bukkit; -var __plugin = plugin; // // private implementation //