Add /bots [level] (Thanks goodlyay)

This commit is contained in:
UnknownShadow200 2016-09-06 18:51:23 +10:00
parent 13cf080c53
commit 38fed28abf
2 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,15 @@ namespace MCGalaxy.Commands {
StringBuilder text = new StringBuilder(); StringBuilder text = new StringBuilder();
PlayerBot[] bots = PlayerBot.Bots.Items; PlayerBot[] bots = PlayerBot.Bots.Items;
Level lvl = null;
if (message != "") {
lvl = LevelInfo.FindMatches(p, message);
if (lvl == null) return;
}
foreach (PlayerBot bot in bots) { foreach (PlayerBot bot in bots) {
if (lvl != null && bot.level != lvl) continue;
text.Append(", ").Append(bot.name) text.Append(", ").Append(bot.name)
.Append("(").Append(bot.level.name).Append(")"); .Append("(").Append(bot.level.name).Append(")");
@ -42,11 +50,12 @@ namespace MCGalaxy.Commands {
if (text.Length > 0) if (text.Length > 0)
Player.Message(p, "&1Bots: %S" + text.ToString(2, text.Length - 2)); Player.Message(p, "&1Bots: %S" + text.ToString(2, text.Length - 2));
else else
Player.Message(p, "No bots are alive."); Player.Message(p, "There are no bots.");
} }
public override void Help(Player p) { public override void Help(Player p) {
Player.Message(p, "%T/bots %H- Shows a list of bots, their AIs and levels"); Player.Message(p, "%T/bots %H- Shows a list of bots, their AIs and levels");
Player.Message(p, "%T/bots [level] %H- Only shows bots on the given level");
} }
} }
} }

View File

@ -1,7 +1,7 @@
/* /*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy) Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and Dual-licensed under the educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at obtain a copy of the Licenses at