public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.ToLower().SplitSpaces(); if (args.Length < 2) { p.Message("You did not specify the destination level name."); return; } string src = args[0]; src = Matcher.FindMaps(p, src); if (src == null) { return; } if (!LevelInfo.Check(p, data.Rank, src, "copy this map")) { return; } string dst = args[1]; if (!Formatter.ValidName(p, dst, "level")) { return; } if (LevelInfo.MapExists(dst)) { p.Message("Level \"" + dst + "\" already exists."); return; } try { LevelActions.CopyLevel(src, dst); } catch (IOException) { p.Message("Level %W" + dst + " %Salready exists!"); return; } Level ignored; LevelConfig cfg = LevelInfo.GetConfig(src, out ignored); p.Message("Level {0} %Shas been copied to {1}", cfg.Color + src, cfg.Color + dst); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } string[] args = message.ToLower().Split(' '); if (args.Length < 2) { Player.Message(p, "You did not specify the destination level name."); return; } string src = args[0], dst = args[1]; if (p != null && !p.group.CanExecute("newlvl")) { Player.Message(p, "You cannot use /copylvl as you cannot use /newlvl."); return; } src = LevelInfo.FindMapMatches(p, src); if (src == null) { return; } if (!Formatter.ValidName(p, dst, "level")) { return; } if (LevelInfo.ExistsOffline(dst)) { Player.Message(p, "The level \"" + dst + "\" already exists."); return; } try { LevelActions.CopyLevel(src, dst); } catch (System.IO.IOException) { Player.Message(p, "The level &c" + dst + " %Salready exists!"); return; } Player.Message(p, "The level &a" + src + " %Shas been copied to &a" + dst + "."); }