Bans will clear if you delete bans.txt

This commit is contained in:
high 2011-07-01 09:46:44 -04:00
parent 7e8486527f
commit b46866e0dd

View file

@ -81,10 +81,17 @@ namespace TShockAPI
/// Reloads the file if it was changed /// Reloads the file if it was changed
/// </summary> /// </summary>
public void EnsureChanges() public void EnsureChanges()
{
if (File.Exists(Path))
{ {
if (new FileInfo(Path).LastWriteTime > LastLoad) if (new FileInfo(Path).LastWriteTime > LastLoad)
LoadBans(); LoadBans();
} }
else
{
Bans.Clear();
}
}
/// <summary> /// <summary>
/// Removes | from the string /// Removes | from the string
@ -98,10 +105,11 @@ namespace TShockAPI
public void LoadBans() public void LoadBans()
{ {
Bans.Clear();
if (!File.Exists(Path)) if (!File.Exists(Path))
return; return;
Bans.Clear();
LastLoad = new FileInfo(Path).LastWriteTime; LastLoad = new FileInfo(Path).LastWriteTime;
foreach (var line in File.ReadAllLines(Path)) foreach (var line in File.ReadAllLines(Path))