From 5f716e1cfeebb9d1f5ac6827287e5337bcda31b1 Mon Sep 17 00:00:00 2001 From: Madpeter Date: Sun, 6 Sep 2020 18:45:49 +0100 Subject: [PATCH] adjusts submasters loading to not be so bad --- BSBshared/BotTypes/BasicBot.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/BSBshared/BotTypes/BasicBot.cs b/BSBshared/BotTypes/BasicBot.cs index f56ab16..a2956e5 100644 --- a/BSBshared/BotTypes/BasicBot.cs +++ b/BSBshared/BotTypes/BasicBot.cs @@ -80,16 +80,21 @@ namespace BetterSecondBotShared.bottypes } if (helpers.notempty(myconfig.Security_SubMasters) == true) { - string[] master_names = myconfig.Security_SubMasters.Split(",", StringSplitOptions.RemoveEmptyEntries); - foreach (string a in master_names) + SubMasters.Clear(); + string[] submaster_names = myconfig.Security_SubMasters.Split(",", StringSplitOptions.RemoveEmptyEntries); + foreach (string a in submaster_names) { - bits = a.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList(); - if (bits.Count == 1) + if (a.Length > 3) { - bits.Add("Resident"); + bits = a.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList(); + if (bits.Count == 1) + { + bits.Add("Resident"); + } + string namesubmaster = String.Join(" ", bits); + SubMasters.Add(namesubmaster); + ConsoleLog.Info("Sub-Master: " + namesubmaster); } - SubMasters.Add(String.Join(" ", bits)); - ConsoleLog.Info("Sub-Master: " + myconfig.Security_MasterUsername); } } ConsoleLog.Info("Build: " + version);