Fix /copylvl and /renamelvl.

This commit is contained in:
UnknownShadow200 2016-01-27 00:11:15 +11:00
parent 0deb3b3dd3
commit 0441e01580
2 changed files with 6 additions and 3 deletions

View File

@ -49,7 +49,10 @@ namespace MCGalaxy.Commands
try try
{ {
File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl"); File.Move("levels/" + foundLevel.name + ".lvl", "levels/" + newName + ".lvl");
File.Move("levels/" + foundLevel.name + ".lvl.backup", "levels/" + newName + ".lvl.backup"); try
{
File.Move("levels/" + foundLevel.name + ".lvl.backup", "levels/" + newName + ".lvl.backup");
} catch { }
try try
{ {

View File

@ -59,7 +59,7 @@ namespace MCGalaxy.Commands
} }
try { try {
File.Copy("levels/" + msg1 + ".lvl", "levels/" + msg2 + ".lvl"); File.Copy("levels/" + msg1 + ".lvl", "levels/" + msg2 + ".lvl");
File.Copy("levels/level properties/" + msg1 + ".properties", "levels/level properties/" + msg1 + ".properties", false); File.Copy("levels/level properties/" + msg1 + ".properties", "levels/level properties/" + msg2 + ".properties", false);
if (File.Exists("blockdefs/lvl_" + msg1 + ".json")) if (File.Exists("blockdefs/lvl_" + msg1 + ".json"))
File.Copy("blockdefs/lvl_" + msg1 + ".json", "blockdefs/lvl_" + msg2 + ".json"); File.Copy("blockdefs/lvl_" + msg1 + ".json", "blockdefs/lvl_" + msg2 + ".json");
} catch (System.IO.FileNotFoundException) { } catch (System.IO.FileNotFoundException) {