mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -04:00
Keep /os spawn as alias for /os setspawn
This commit is contained in:
parent
1d92aa8f8e
commit
e912687a6d
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user