From c774b5631f9d77d6632e3f9769e7a03474869057 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Wed, 1 Jan 2014 21:02:11 +0000 Subject: [PATCH] Moved scriptcraft dir from {craftbukkit-root}/scriptcraft to {craftbukkt-root}/plugins/scriptcraft in line with other plugins --- docs/release-notes.md | 14 ++++++++++++++ .../scriptcraft/ScriptCraftPlugin.java | 12 +++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index db37ff2..7187f10 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -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 diff --git a/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java b/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java index 4cbe96a..bbdfae3 100644 --- a/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java +++ b/src/main/java/net/walterhiggins/scriptcraft/ScriptCraftPlugin.java @@ -23,8 +23,9 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener // need to look at possibly having context/scope per operator //protected Map playerContexts = new HashMap(); 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);