diff --git a/MCGalaxy/Commands/Bots/CmdBots.cs b/MCGalaxy/Commands/Bots/CmdBots.cs index 025e8ffd7..6f96bdfb7 100644 --- a/MCGalaxy/Commands/Bots/CmdBots.cs +++ b/MCGalaxy/Commands/Bots/CmdBots.cs @@ -26,7 +26,7 @@ namespace MCGalaxy.Commands.Bots { public override LevelPermission defaultRank { get { return LevelPermission.Builder; } } public override void Use(Player p, string message) { - Level lvl = p.level; + Level lvl = p == null ? null : p.level; string[] args = message.SplitSpaces(2); int ignored, offset = 0; @@ -39,13 +39,15 @@ namespace MCGalaxy.Commands.Bots { PlayerBot[] bots = PlayerBot.Bots.Items; List inScope = new List(); foreach (PlayerBot bot in bots) { - if (bot.level != lvl) continue; + if (lvl != null && bot.level != lvl) continue; inScope.Add(bot); } - string cmd = lvl == p.level ? "bots" : "bots " + lvl.name; + string cmd = (lvl == null || lvl == p.level) ? "bots" : "bots " + lvl.name; string modifier = args.Length > offset ? args[offset] : ""; - Player.Message(p, "Bots in {0}:", lvl.ColoredName); + + string group = lvl == null ? "All bots:" : "Bots in " + lvl.ColoredName + ":"; + Player.Message(p, group); MultiPageOutput.Output(p, inScope, FormatBot, cmd, "bots", modifier, false); } diff --git a/MCGalaxy/Commands/other/CmdBack.cs b/MCGalaxy/Commands/other/CmdBack.cs index 77c789c1b..ed6531972 100644 --- a/MCGalaxy/Commands/other/CmdBack.cs +++ b/MCGalaxy/Commands/other/CmdBack.cs @@ -23,11 +23,12 @@ namespace MCGalaxy.Commands.Misc { public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public override void Use(Player p, string message) { - if (p.beforeTeleportMap == "") { + if (p.lastTeleportMap == "") { Player.Message(p, "You have not teleported anywhere yet"); return; } - if (!p.level.name.CaselessEq(p.beforeTeleportMap)) - PlayerActions.ChangeMap(p, p.beforeTeleportMap); + + if (!p.level.name.CaselessEq(p.lastTeleportMap)) + PlayerActions.ChangeMap(p, p.lastTeleportMap); p.SendPos(Entities.SelfID, p.beforeTeleportPos, new Orientation(0, 0)); } diff --git a/MCGalaxy/Commands/other/CmdTp.cs b/MCGalaxy/Commands/other/CmdTp.cs index a3af20ed2..28e8ec38f 100644 --- a/MCGalaxy/Commands/other/CmdTp.cs +++ b/MCGalaxy/Commands/other/CmdTp.cs @@ -44,7 +44,7 @@ namespace MCGalaxy.Commands.Misc { Help(p); return; } - p.beforeTeleportMap = p.level.name; + p.lastTeleportMap = p.level.name; p.beforeTeleportPos = p.Pos; Level lvl = bot != null ? bot.level : target.level; diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index bc596fdcb..817da4e38 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -224,7 +224,7 @@ namespace MCGalaxy { internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0; public Vec3U16 lastClick = Vec3U16.Zero; public Position beforeTeleportPos = default(Position); - public string beforeTeleportMap = ""; + public string lastTeleportMap = ""; public ushort[] pos = new ushort[3]; public byte[] rot = new byte[2]; internal Position tempPos;