Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
5da9d55cb8
Commit
1128a43010
@ -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<String>() {
|
||||
@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
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren