From 8bd33f42f37a09dfe5f40ee8b76bedb752ba726e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 2 Sep 2017 23:11:53 +1000 Subject: [PATCH] Allow specifying max number of bots allowed on a map --- MCGalaxy/Commands/Bots/CmdBot.cs | 3 +++ MCGalaxy/Server/ServerConfig.cs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/MCGalaxy/Commands/Bots/CmdBot.cs b/MCGalaxy/Commands/Bots/CmdBot.cs index 0e99f3d86..0c17debdc 100644 --- a/MCGalaxy/Commands/Bots/CmdBot.cs +++ b/MCGalaxy/Commands/Bots/CmdBot.cs @@ -56,6 +56,9 @@ namespace MCGalaxy.Commands.Bots { if (BotExists(p.level, botName)) { Player.Message(p, "A bot with that name already exists."); return; } + if (p.level.Bots.Count >= ServerConfig.MaxBotsPerLevel) { + Player.Message(p, "Reached maximum number of bots allowed on this map."); return; + } PlayerBot bot = new PlayerBot(botName, p.level); bot.Pos = p.Pos; diff --git a/MCGalaxy/Server/ServerConfig.cs b/MCGalaxy/Server/ServerConfig.cs index 34b891e0e..cf87cb70d 100644 --- a/MCGalaxy/Server/ServerConfig.cs +++ b/MCGalaxy/Server/ServerConfig.cs @@ -102,6 +102,8 @@ namespace MCGalaxy { [ConfigString("default-rank", "General", "guest")] public static string DefaultRankName = "guest"; + [ConfigInt("max-bots-per-level", "Other", 192, 0, 256)] + public static int MaxBotsPerLevel = 192; [ConfigBool("deathcount", "Other", true)] public static bool AnnounceDeathCount = true; [ConfigBool("use-whitelist", "Other", false)]