mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
fix /import all including filename, fix erroring when trying to import unsupported format
This commit is contained in:
parent
1ad142f596
commit
6636d9cb5a
@ -35,21 +35,21 @@ namespace MCGalaxy.Commands.World {
|
||||
|
||||
if (message.CaselessEq("all")) {
|
||||
string[] maps = Directory.GetFiles(Paths.ImportsDir);
|
||||
foreach (string map in maps) {
|
||||
Import(p, Path.GetFileName(map));
|
||||
}
|
||||
foreach (string map in maps) { Import(p, map); }
|
||||
} else {
|
||||
Import(p, message);
|
||||
}
|
||||
}
|
||||
|
||||
static void Import(Player p, string map) {
|
||||
map = Path.GetFileNameWithoutExtension(map);
|
||||
string path = Paths.ImportsDir + map;
|
||||
IMapImporter importer = IMapImporter.Find(ref path);
|
||||
|
||||
if (importer == null) {
|
||||
string formats = IMapImporter.Formats.Join(imp => imp.Extension);
|
||||
p.Message("%WNo {0} file with that name was found in /extra/import folder.", formats);
|
||||
return;
|
||||
}
|
||||
|
||||
if (LevelInfo.MapExists(map)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user