diff --git a/MCGalaxy/Commands/World/CmdLoad.cs b/MCGalaxy/Commands/World/CmdLoad.cs index 96fdc25fb..e05ee777a 100644 --- a/MCGalaxy/Commands/World/CmdLoad.cs +++ b/MCGalaxy/Commands/World/CmdLoad.cs @@ -45,20 +45,21 @@ namespace MCGalaxy.Commands.World { } static Level LoadLevelCore(Player p, string name, bool autoLoaded) { - Level[] loaded = LevelInfo.Loaded.Items; - foreach (Level l in loaded) { - if (l.name == name) { Player.Message(p, "Level {0} %Sis already loaded.", l.ColoredName); return null; } - } if (!LevelInfo.MapExists(name)) { Player.Message(p, "Level \"{0}\" does not exist", name); return null; } + Level existing = LevelInfo.FindExact(name); + if (existing != null) { + Player.Message(p, "Level {0} %Sis already loaded.", existing.ColoredName); return null; + } + Level lvl = ReadLevel(p, name); if (lvl == null || !lvl.CanJoin(p)) return null; - loaded = LevelInfo.Loaded.Items; - foreach (Level l in loaded) { - if (l.name == name) { Player.Message(p, "Level {0} %Sis already loaded.", l.ColoredName); return null; } + existing = LevelInfo.FindExact(name); + if (existing != null) { + Player.Message(p, "Level {0} %Sis already loaded.", existing.ColoredName); return null; } LevelInfo.Loaded.Add(lvl); diff --git a/MCGalaxy/Commands/World/CmdOverseer.cs b/MCGalaxy/Commands/World/CmdOverseer.cs index 8342a84e0..da162ebc2 100644 --- a/MCGalaxy/Commands/World/CmdOverseer.cs +++ b/MCGalaxy/Commands/World/CmdOverseer.cs @@ -32,16 +32,18 @@ namespace MCGalaxy.Commands.World { public override void Use(Player p, string message) { if (message.Length == 0) { Help(p); return; } - string[] parts = message.SplitSpaces(3); - string cmd = parts[0].ToUpper(); - string arg = parts.Length > 1 ? parts[1] : ""; - string arg2 = parts.Length > 2 ? parts[2] : ""; + string[] args = message.SplitSpaces(3); + string cmd = args[0]; + string arg = args.Length > 1 ? args[1] : ""; + string arg2 = args.Length > 2 ? args[2] : ""; - bool mapOnly = !(cmd == "GO" || cmd == "MAP"); + bool mapOnly = !(cmd.CaselessEq("go") || cmd.CaselessEq("map")); if (mapOnly && !OwnsMap(p, p.level)) { Player.Message(p, "You may only perform that action on your own map."); return; } + // used to be /os spawn, keep alias for backwards compatibility + if (cmd.CaselessEq("spawn")) cmd = "setspawn"; foreach (var subCmd in subCommands) { if (!subCmd.Key.CaselessEq(cmd)) continue; subCmd.Value.Handler(p, arg, arg2);