Moved scriptcraft dir from {craftbukkit-root}/scriptcraft to {craftbukkt-root}/plugins/scriptcraft in line with other plugins

This commit is contained in:
walterhiggins 2014-01-01 21:02:11 +00:00
parent 220d246b42
commit c774b5631f
2 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,17 @@
# 2014 01 01
'Buddha' Release - towards a total elimination of the 'self' variable.
The 'self' variable should only be used at the in-game or server
console command prompts and should not be used in modules or in
multi-threaded code.
Moved scriptcraft directory from {craftbukkit-root}/scriptcraft to
{craftbukkit-root}/plugins/scriptcraft because this seems to be where
other plugins create plugin-specific directories on the filesystem.
Documentation updates. Added new sections to the Young Persons Guide
to Modding Minecraft.
# 2013 12 30
Removing coffeescript support because coffeescript.js will not

View file

@ -23,8 +23,9 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
// need to look at possibly having context/scope per operator
//protected Map<CommandSender,ScriptCraftEvaluator> playerContexts = new HashMap<CommandSender,ScriptCraftEvaluator>();
protected ScriptEngine engine = null;
private static final String JS_PLUGINS_DIR = "scriptcraft";
private static final String JS_PLUGINS_DIR = "plugins/scriptcraft";
private static final String JS_PLUGINS_ZIP = "scriptcraft.zip";
/**
* Unzips bundled javascript code.
*/
@ -41,13 +42,14 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
jsPlugins.mkdir();
}
ZipInputStream zis = new ZipInputStream(getResource(JS_PLUGINS_DIR + ".zip"));
ZipInputStream zis = new ZipInputStream(getResource(JS_PLUGINS_ZIP));
ZipEntry entry;
try {
while ( ( entry = zis.getNextEntry() ) != null)
{
String filename = entry.getName();
File newFile = new File(jsPlugins.getName() + File.separator + filename);
//File newFile = new File(jsPlugins.getName() + File.separator + filename);
File newFile = new File(jsPlugins, filename);
//create all non exists folders
//else you will hit FileNotFoundException for compressed folder
@ -67,7 +69,7 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
unzip = true;
}
if (unzip){
getLogger().info("Unzipping " + filename);
getLogger().info("Unzipping " + newFile.getCanonicalPath());
FileOutputStream fout = new FileOutputStream(newFile);
for (int c = zis.read(); c != -1; c = zis.read()) {
fout.write(c);