From fb70a24c04a5beec6cc7ff9248ef8f5fd46fcc87 Mon Sep 17 00:00:00 2001 From: sowgro Date: Thu, 29 Aug 2024 21:51:14 -0400 Subject: Implement new create dialog --- src/main/java/net/sowgro/npehero/levelapi/Difficulties.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java/net/sowgro/npehero/levelapi/Difficulties.java') diff --git a/src/main/java/net/sowgro/npehero/levelapi/Difficulties.java b/src/main/java/net/sowgro/npehero/levelapi/Difficulties.java index ea17e21..cfb3673 100644 --- a/src/main/java/net/sowgro/npehero/levelapi/Difficulties.java +++ b/src/main/java/net/sowgro/npehero/levelapi/Difficulties.java @@ -82,7 +82,7 @@ public class Difficulties { * @param text The name of the directory * @throws IOException If there is a problem adding the level */ - public void add(String text) throws IOException { + public Difficulty add(String text) throws IOException { File diffDir = new File(level.dir, text.toLowerCase().replaceAll("\\W+", "-")); if (diffDir.exists()) { throw new FileAlreadyExistsException(diffDir.getName()); @@ -92,6 +92,7 @@ public class Difficulties { temp.title = text; list.add(temp); list.sort(Comparator.naturalOrder()); + return temp; } else { throw new IOException(); -- cgit v1.2.3