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")
|
@Register(value = "rename", description = "BUILDERCLOUD_RENAME_USAGE")
|
||||||
public void rename(ProxiedPlayer player, @ErrorMessage("BUILDERCLOUD_VERSION") ServerStarter.Version version, @Mapper("map") String oldName, String newName) {
|
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);
|
File newMap = mapFile(version, newName);
|
||||||
if(newMap.exists()) {
|
if(newMap.exists()) {
|
||||||
ChatSender.of(player).system("BUILDERCLOUD_EXISTING_MAP");
|
ChatSender.of(player).system("BUILDERCLOUD_EXISTING_MAP");
|
||||||
@ -52,7 +58,7 @@ public class BuilderCloudCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.move(mapFile(version, oldName).toPath(), newMap.toPath());
|
Files.move(oldMap.toPath(), newMap.toPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
@ -82,16 +88,7 @@ public class BuilderCloudCommand extends SWCommand {
|
|||||||
return new TypeMapper<String>() {
|
return new TypeMapper<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||||
File folder = getWorldFolder(previousArguments, 1);
|
return s;
|
||||||
|
|
||||||
if(folder == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
File map = new File(folder, s);
|
|
||||||
if(!map.exists() && !map.mkdir())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return map.getName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren