fix for issue #69
This commit is contained in:
parent
6e113a2eca
commit
66abbfc142
3 changed files with 61 additions and 29 deletions
13
docs/api.md
13
docs/api.md
|
@ -219,6 +219,19 @@ There are a couple of special javascript variables available in ScriptCraft...
|
|||
* server - The Minecraft Server object.
|
||||
* self - the current player. (Note - this value should not be used in multi-threaded scripts - it's not thread-safe)
|
||||
|
||||
refresh() function
|
||||
------------------
|
||||
The refresh() function will ...
|
||||
|
||||
1. Disable the ScriptCraft plugin.
|
||||
2. Unload all event listeners associated with the ScriptCraft plugin.
|
||||
3. Enable the ScriptCraft plugin.
|
||||
|
||||
... refresh() can be used during development to reload only scriptcraft javascript files.
|
||||
See [issue #69][issue69] for more information.
|
||||
|
||||
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
|
||||
|
||||
Drone.spiral_stairs() method
|
||||
============================
|
||||
Constructs a spiral staircase with slabs at each corner.
|
||||
|
|
|
@ -89,8 +89,6 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
|
|||
public void onEnable()
|
||||
{
|
||||
unzipJS();
|
||||
|
||||
if (this.engine == null){
|
||||
FileReader reader = null;
|
||||
try{
|
||||
ScriptEngineManager factory = new ScriptEngineManager();
|
||||
|
@ -113,7 +111,6 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd,
|
||||
String alias,
|
||||
String[] args)
|
||||
|
|
|
@ -645,12 +645,33 @@ var server = org.bukkit.Bukkit.server;
|
|||
var unloadHandlers = [];
|
||||
var _addUnloadHandler = function(f) {
|
||||
unloadHandlers.push(f);
|
||||
}
|
||||
};
|
||||
var _runUnloadHandlers = function() {
|
||||
for (var i = 0; i < unloadHandlers.length; i++) {
|
||||
unloadHandlers[i]();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
refresh() function
|
||||
------------------
|
||||
The refresh() function will ...
|
||||
|
||||
1. Disable the ScriptCraft plugin.
|
||||
2. Unload all event listeners associated with the ScriptCraft plugin.
|
||||
3. Enable the ScriptCraft plugin.
|
||||
|
||||
... refresh() can be used during development to reload only scriptcraft javascript files.
|
||||
See [issue #69][issue69] for more information.
|
||||
|
||||
[issue69]: https://github.com/walterhiggins/ScriptCraft/issues/69
|
||||
|
||||
***/
|
||||
global.refresh = function(){
|
||||
__plugin.pluginLoader.disablePlugin(__plugin);
|
||||
forg.bukkit.event.HandlerList["unregisterAll(org.bukkit.plugin.Plugin)"](__plugin);
|
||||
__plugin.pluginLoader.enablePlugin(__plugin);
|
||||
};
|
||||
|
||||
global.load = _load;
|
||||
global.save = _save;
|
||||
|
@ -685,6 +706,7 @@ var server = org.bukkit.Bukkit.server;
|
|||
_runUnloadHandlers();
|
||||
});
|
||||
|
||||
|
||||
}());
|
||||
|
||||
|
||||
|
|
Reference in a new issue