diff --git a/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java b/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java index 84740ba..640ea7a 100644 --- a/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java +++ b/src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java @@ -45,6 +45,12 @@ public class BuilderCloudCommand extends SWCommand { @Register(value = "rename", description = "BUILDERCLOUD_RENAME_USAGE") public void rename(ProxiedPlayer player, @ErrorMessage("BUILDERCLOUD_VERSION") ServerStarter.Version version, @Mapper("map") String oldName, String newName) { + File oldMap = mapFile(version, oldName); + if(!oldMap.exists()) { + ChatSender.of(player).system("BUILDERCLOUD_UNKNOWN_MAP"); + return; + } + File newMap = mapFile(version, newName); if(newMap.exists()) { ChatSender.of(player).system("BUILDERCLOUD_EXISTING_MAP"); @@ -52,7 +58,7 @@ public class BuilderCloudCommand extends SWCommand { } try { - Files.move(mapFile(version, oldName).toPath(), newMap.toPath()); + Files.move(oldMap.toPath(), newMap.toPath()); } catch (IOException e) { throw new SecurityException(e); } @@ -82,16 +88,7 @@ public class BuilderCloudCommand extends SWCommand { return new TypeMapper() { @Override public String map(CommandSender commandSender, String[] previousArguments, String s) { - File folder = getWorldFolder(previousArguments, 1); - - if(folder == null) - return null; - - File map = new File(folder, s); - if(!map.exists() && !map.mkdir()) - return null; - - return map.getName(); + return s; } @Override