From 1128a43010df1218bdd0ce47c3d0c4e3b8228112 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 23 Jul 2023 17:43:53 +0200 Subject: [PATCH] Fix buildercloud Signed-off-by: Lixfel --- .../commands/BuilderCloudCommand.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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