diff --git a/pom.xml b/pom.xml
index fd8224150..4d6caa2c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
me.blackvein.quests
quests
- 3.2.1
+ 3.2.2
quests
https://github.com/FlyingPikachu/Quests/
jar
diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java
index 56100c170..e34d6c258 100644
--- a/src/main/java/me/blackvein/quests/Quests.java
+++ b/src/main/java/me/blackvein/quests/Quests.java
@@ -228,6 +228,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
+ /**
+ * Save a Quests plugin resource to a specific path in the filesystem
+ *
+ * @param resourcePath jar file location starting from resource folder, i.e. "lang/el-GR/strings.yml"
+ * @param outputPath file destination starting from Quests folder, i.e. "lang/el-GR/strings.yml"
+ * @param replace whether or not to replace the destination file
+ */
public void saveResourceAs(String resourcePath, String outputPath, boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
@@ -238,12 +245,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (in == null) {
throw new IllegalArgumentException("The embedded resource '" + resourcePath + "' cannot be found in Quests jar");
}
-
- String outPath = outputPath.replaceAll("/", File.separator);
+
+ String outPath = outputPath.replace('/', File.separatorChar).replace('\\', File.separatorChar);
File outFile = new File(getDataFolder(), outPath);
- int lastIndex = resourcePath.lastIndexOf(File.separator);
- File outDir = new File(getDataFolder(), outPath.substring(0, lastIndex >= 0 ? lastIndex : 0));
-
+ File outDir = new File(outFile.getPath().replace(outFile.getName(), ""));
+
if (!outDir.exists()) {
outDir.mkdirs();
}