mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -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")) {
|
if (message.CaselessEq("all")) {
|
||||||
string[] maps = Directory.GetFiles(Paths.ImportsDir);
|
string[] maps = Directory.GetFiles(Paths.ImportsDir);
|
||||||
foreach (string map in maps) {
|
foreach (string map in maps) { Import(p, map); }
|
||||||
Import(p, Path.GetFileName(map));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Import(p, message);
|
Import(p, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Import(Player p, string map) {
|
static void Import(Player p, string map) {
|
||||||
|
map = Path.GetFileNameWithoutExtension(map);
|
||||||
string path = Paths.ImportsDir + map;
|
string path = Paths.ImportsDir + map;
|
||||||
IMapImporter importer = IMapImporter.Find(ref path);
|
IMapImporter importer = IMapImporter.Find(ref path);
|
||||||
|
|
||||||
if (importer == null) {
|
if (importer == null) {
|
||||||
string formats = IMapImporter.Formats.Join(imp => imp.Extension);
|
string formats = IMapImporter.Formats.Join(imp => imp.Extension);
|
||||||
p.Message("%WNo {0} file with that name was found in /extra/import folder.", formats);
|
p.Message("%WNo {0} file with that name was found in /extra/import folder.", formats);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LevelInfo.MapExists(map)) {
|
if (LevelInfo.MapExists(map)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user