aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/sowgro/npehero/levelapi/Levels.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/sowgro/npehero/levelapi/Levels.java')
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/levelapi/Levels.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/net/sowgro/npehero/levelapi/Levels.java b/src/main/java/net/sowgro/npehero/levelapi/Levels.java
index c82c2fa..37878d8 100755
--- a/src/main/java/net/sowgro/npehero/levelapi/Levels.java
+++ b/src/main/java/net/sowgro/npehero/levelapi/Levels.java
@@ -39,7 +39,7 @@ public class Levels {
try {
Level level = new Level(file);
list.add(level);
- } catch (IOException e) {
+ } catch (Exception e) {
problems.put(file.getName(), e);
e.printStackTrace();
}
@@ -52,7 +52,7 @@ public class Levels {
* @param text: the name of the directory and default title
* @throws IOException if there was an error adding the level
*/
- public static void add(String text) throws IOException {
+ public static Level add(String text) throws IOException {
File levelDir = new File(dir, text.toLowerCase().replaceAll("\\W+", "-"));
if (levelDir.exists()) {
throw new FileAlreadyExistsException(levelDir.getName());
@@ -61,6 +61,7 @@ public class Levels {
Level temp = new Level(levelDir);
temp.title = text;
list.add(temp);
+ return temp;
}
else {
throw new IOException();