Move bot owners to ini settings

- Bot owners now specified directly in the INI file
- Owners list is now in Settings.cs and not in Hangman bot
- Allow other bots to access owner list
This commit is contained in:
ORelio 2014-04-02 23:25:28 +02:00
parent a481640306
commit fc281889c6
2 changed files with 9 additions and 25 deletions

View file

@ -355,7 +355,6 @@ namespace MinecraftClient
private bool[] discovered;
private string word = "";
private string letters = "";
private string[] owners;
private bool English;
/// <summary>
@ -368,11 +367,6 @@ namespace MinecraftClient
English = english;
}
public override void Initialize()
{
owners = getowners();
}
public override void Update()
{
if (running)
@ -398,7 +392,7 @@ namespace MinecraftClient
if (isPrivateMessage(text, ref message, ref username))
{
if (owners.Contains(username.ToUpper()))
if (Settings.Bots_Owners.Contains(username.ToLower()))
{
switch (message)
{
@ -495,21 +489,6 @@ namespace MinecraftClient
}
}
private string[] getowners()
{
List<string> owners = new List<string>();
owners.Add("CONSOLE");
if (System.IO.File.Exists(Settings.Bots_OwnersFile))
{
foreach (string s in System.IO.File.ReadAllLines(Settings.Bots_OwnersFile))
{
owners.Add(s.ToUpper());
}
}
else LogToConsole(English ? "File not found: " + Settings.Bots_OwnersFile : "Fichier introuvable : " + Settings.Bots_OwnersFile);
return owners.ToArray();
}
private string word_cached
{
get